Skip to content

Commit

Permalink
Add extract-common-text.sh scrpit
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Sep 7, 2023
1 parent a4f7cfe commit e86619e
Show file tree
Hide file tree
Showing 12 changed files with 902 additions and 878 deletions.
124 changes: 62 additions & 62 deletions src/Makefile.arch
Original file line number Diff line number Diff line change
Expand Up @@ -46,86 +46,86 @@ endef
$(eval $(foreach a,$(ARCHS),$(call objs-arch,$(a))))

# target list for each architecture.
TGT_mc6809 = mc6809 hd6309
TGT_mc6800 = mc6800 mb8861 mc6801 mc68hc11 hd6301
TGT_mc6805 = mc68hc05
TGT_mos6502 = mos6502 g65sc02 r65c02 w65c02s w65c816
TGT_i8048 = i8039 i8048 i80c39 i80c48 msm80c39 msm80c48
TGT_i8051 = i8051
TGT_i8080 = i8080 i8085 v30emu
TGT_i8096 = i8096
TGT_z80 = z80 i8080_z80syn i8085_z80syn v30emu_z80syn
TGT_z8 = z8 z86c z88
TGT_tlcs90 = tlcs90
TGT_ins8060 = ins8060
TGT_ins8070 = ins8070
TGT_cdp1802 = cdp1802 cdp1804 cdp1804a
TGT_scn2650 = scn2650
TGT_f3850 = f3850
TGT_i8086 = i8086 i80186 v30
TGT_tms9900 = tms9900 tms9995 tms99105
TGT_tms32010= tms32010
TGT_mc68000 = mc68000
TGT_z8000 = z8001 z8002 z8k1 z8k2
TGT_ns32000 = ns32000 ns32k
TGT_mn1610 = mn1610 mn1613
TGT_cdp1802 = cdp1802 cdp1804 cdp1804a
TGT_f3850 = f3850
TGT_i8048 = i8039 i8048 i80c39 i80c48 msm80c39 msm80c48
TGT_i8051 = i8051
TGT_i8080 = i8080 i8085 v30emu
TGT_i8086 = i8086 i80186 v30
TGT_i8096 = i8096
TGT_ins8060 = ins8060
TGT_ins8070 = ins8070
TGT_mc68000 = mc68000
TGT_mc6800 = mc6800 mb8861 mc6801 mc68hc11 hd6301
TGT_mc6805 = mc68hc05
TGT_mc6809 = mc6809 hd6309
TGT_mn1610 = mn1610 mn1613
TGT_mos6502 = mos6502 g65sc02 r65c02 w65c02s w65c816
TGT_ns32000 = ns32000 ns32k
TGT_scn2650 = scn2650
TGT_tlcs90 = tlcs90
TGT_tms32010 = tms32010
TGT_tms9900 = tms9900 tms9995 tms99105
TGT_z8000 = z8001 z8002 z8k1 z8k2
TGT_z80 = z80 i8080_z80syn i8085_z80syn v30emu_z80syn
TGT_z8 = z8 z86c z88

# CPU for each target
CPU_mc6809 = 6809
CPU_hd6309 = 6309
CPU_mc6800 = 6800
CPU_mb8861 = mb8861
CPU_mc6801 = 6801
CPU_mc68hc11 = 6811
CPU_hd6301 = 6301
CPU_mc68hc05 = 68hc05
CPU_mos6502 = 6502
CPU_cdp1802 = 1802
CPU_cdp1804 = 1804
CPU_cdp1804a = 1804A
CPU_f3850 = F3850
CPU_g65sc02 = 65SC02
CPU_r65c02 = 65C02
CPU_w65c02s = W65C02S
CPU_w65c816 = 65816
CPU_hd6301 = 6301
CPU_hd6309 = 6309
CPU_i80186 = 80186
CPU_i8039 = 8039
CPU_i8048 = 8048
CPU_i80c39 = 80c39
CPU_i80c48 = 80c48
CPU_msm80c39 = msm80c39
CPU_msm80c48 = msm80c48
CPU_i8051 = 8051
CPU_i8080 = 8080
CPU_i8085 = 8085
CPU_v30emu = V30EMU
CPU_i8096 = 8096
CPU_z80 = Z80
CPU_i8080_z80syn = 8080
CPU_i8085 = 8085
CPU_i8085_z80syn = 8085
CPU_v30emu_z80syn = V30EMU
CPU_z8 = Z8601
CPU_z86c = Z86C40
CPU_z88 = Z88C00
CPU_tlcs90 = TLCS90
CPU_i8086 = 8086
CPU_i8096 = 8096
CPU_i80c39 = 80C39
CPU_i80c48 = 80C48
CPU_ins8060 = SC/MP
CPU_ins8070 = 8070
CPU_cdp1802 = 1802
CPU_cdp1804 = 1804
CPU_cdp1804a = 1804A
CPU_mb8861 = MB8861
CPU_mc68000 = 68000
CPU_mc6800 = 6800
CPU_mc6801 = 6801
CPU_mc6809 = 6809
CPU_mc68hc05 = 68HC05
CPU_mc68hc11 = 6811
CPU_mn1610 = MN1610
CPU_mn1613 = MN1613
CPU_mos6502 = 6502
CPU_msm80c39 = MSM80C39
CPU_msm80c48 = MSM80C48
CPU_ns32000 = NS32032
CPU_ns32k = NS32032
CPU_r65c02 = 65C02
CPU_scn2650 = 2650
CPU_f3850 = F3850
CPU_i8086 = 8086
CPU_i80186 = 80186
CPU_v30 = V30
CPU_tlcs90 = TLCS90
CPU_tms32010 = 32010
CPU_tms9900 = TMS9900
CPU_tms9995 = TMS9995
CPU_tms99105 = TMS99105
CPU_tms32010 = 32010
CPU_mc68000 = 68000
CPU_tms9995 = TMS9995
CPU_v30emu = V30EMU
CPU_v30emu_z80syn = V30EMU
CPU_v30 = V30
CPU_w65c02s = W65C02S
CPU_w65c816 = 65816
CPU_z8001 = Z8001
CPU_z8002 = Z8002
CPU_z80 = Z80
CPU_z86c = Z86C40
CPU_z88 = Z88C00
CPU_z8k1 = Z8001
CPU_z8k2 = Z8002
CPU_ns32000 = ns32032
CPU_ns32k = ns32032
CPU_mn1610 = MN1610
CPU_mn1613 = MN1613
CPU_z8 = Z8601

# targets with Motorola S19 format
S19_OUTS = $(TGT_mc6809) $(TGT_mc6800) $(TGT_mc6805) mos6502 g65sc02 r65c02 w65c02s m6811
Expand Down
24 changes: 24 additions & 0 deletions src/exract-common-text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

function get_text {
grep -Ev 'TEXT_[A-Z]+_' "$@" | grep -Po '(?<!_)TEXT_[A-Z0-9]+'
}

function list_array {
local t
for t in "$@"; do
echo "$t"
done
}

declare -ar text_files=($(list_array text_*.h | grep -v text_common.h))

declare -a texts=()
for f in "${text_files[@]}"; do
texts=($(sort <(list_array "${texts[@]}") <(get_text "$f")))
done

declare -ar duplicated=$(list_array "${texts[@]}" | uniq -d)
declare -ar common=($(get_text text_common.h | sort))

diff -u <(list_array "${common[@]}") <(list_array "${duplicated}") | grep '^+'
Loading

0 comments on commit e86619e

Please sign in to comment.