Skip to content

Commit

Permalink
Cleanup duplicated TEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Oct 8, 2024
1 parent b678865 commit 06090dc
Show file tree
Hide file tree
Showing 15 changed files with 107 additions and 102 deletions.
21 changes: 13 additions & 8 deletions src/exract-common-text.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/bash

function get_text {
grep -Po '(?<!__LIBASM_)TEXT_[\w_]+' "$@"
grep -hPo '(?<=^extern const char )TEXT_[\w_]+' "$@"
}

function list_files {
for f in $(grep -lPow '(?<=^extern const char )'"$1" text_*.h); do
printf "%-15s" $f
done
echo
}

function list_array {
Expand All @@ -11,14 +18,12 @@ function list_array {
done
}

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

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

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

diff -u <(list_array "${common[@]}") <(list_array "${duplicated[@]}") | grep '^+'
for t in $(list_array "${texts[@]}" | uniq -d); do
printf "%-7s" "${t/TEXT_/}"
list_files "$t"
done
34 changes: 17 additions & 17 deletions src/text_cdp1802.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,37 +89,37 @@ constexpr char TEXT_LSZ[] PROGMEM = "LSZ";
constexpr char TEXT_MARK[] PROGMEM = "MARK";
constexpr char TEXT_NBR[] PROGMEM = "NBR";
constexpr char TEXT_NLBR[] PROGMEM = "NLBR";
constexpr char TEXT_NOP[] PROGMEM = "NOP";
constexpr char TEXT_OR[] PROGMEM = "OR";
constexpr char TEXT_ORI[] PROGMEM = "ORI";
constexpr char TEXT_OUT[] PROGMEM = "OUT";
// constexpr char TEXT_NOP[] PROGMEM = "NOP";
// constexpr char TEXT_OR[] PROGMEM = "OR";
// constexpr char TEXT_ORI[] PROGMEM = "ORI";
// constexpr char TEXT_OUT[] PROGMEM = "OUT";
constexpr char TEXT_PHI[] PROGMEM = "PHI";
constexpr char TEXT_PLO[] PROGMEM = "PLO";
constexpr char TEXT_REQ[] PROGMEM = "REQ";
constexpr char TEXT_RET[] PROGMEM = "RET";
// constexpr char TEXT_RET[] PROGMEM = "RET";
constexpr char TEXT_RSHL[] PROGMEM = "RSHL";
constexpr char TEXT_RSHR[] PROGMEM = "RSHR";
constexpr char TEXT_SAV[] PROGMEM = "SAV";
constexpr char TEXT_SD[] PROGMEM = "SD";
// constexpr char TEXT_SD[] PROGMEM = "SD";
constexpr char TEXT_SDB[] PROGMEM = "SDB";
constexpr char TEXT_SDBI[] PROGMEM = "SDBI";
constexpr char TEXT_SDI[] PROGMEM = "SDI";
constexpr char TEXT_SEP[] PROGMEM = "SEP";
constexpr char TEXT_SEQ[] PROGMEM = "SEQ";
constexpr char TEXT_SEX[] PROGMEM = "SEX";
constexpr char TEXT_SHL[] PROGMEM = "SHL";
// constexpr char TEXT_SEP[] PROGMEM = "SEP";
// constexpr char TEXT_SEQ[] PROGMEM = "SEQ";
// constexpr char TEXT_SEX[] PROGMEM = "SEX";
// constexpr char TEXT_SHL[] PROGMEM = "SHL";
constexpr char TEXT_SHLC[] PROGMEM = "SHLC";
constexpr char TEXT_SHR[] PROGMEM = "SHR";
// constexpr char TEXT_SHR[] PROGMEM = "SHR";
constexpr char TEXT_SHRC[] PROGMEM = "SHRC";
// constexpr char TEXT_SKP[] PROGMEM = "SKP";
constexpr char TEXT_SM[] PROGMEM = "SM";
// constexpr char TEXT_SM[] PROGMEM = "SM";
constexpr char TEXT_SMB[] PROGMEM = "SMB";
constexpr char TEXT_SMBI[] PROGMEM = "SMBI";
constexpr char TEXT_SMI[] PROGMEM = "SMI";
constexpr char TEXT_STR[] PROGMEM = "STR";
// constexpr char TEXT_SMI[] PROGMEM = "SMI";
// constexpr char TEXT_STR[] PROGMEM = "STR";
constexpr char TEXT_STXD[] PROGMEM = "STXD";
constexpr char TEXT_XOR[] PROGMEM = "XOR";
constexpr char TEXT_XRI[] PROGMEM = "XRI";
// constexpr char TEXT_XOR[] PROGMEM = "XOR";
// constexpr char TEXT_XRI[] PROGMEM = "XRI";

// CDP1804
constexpr char TEXT_BCI[] PROGMEM = "BCI";
Expand All @@ -129,7 +129,7 @@ constexpr char TEXT_CIE[] PROGMEM = "CIE";
constexpr char TEXT_DTC[] PROGMEM = "DTC";
constexpr char TEXT_ETQ[] PROGMEM = "ETQ";
constexpr char TEXT_GEC[] PROGMEM = "GEC";
constexpr char TEXT_LDC[] PROGMEM = "LDC";
// constexpr char TEXT_LDC[] PROGMEM = "LDC";
constexpr char TEXT_RLDI[] PROGMEM = "RLDI";
constexpr char TEXT_RLXA[] PROGMEM = "RLXA";
constexpr char TEXT_RNX[] PROGMEM = "RNX";
Expand Down
34 changes: 17 additions & 17 deletions src/text_cdp1802.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,37 @@ extern const char TEXT_LSZ[] PROGMEM;
extern const char TEXT_MARK[] PROGMEM;
extern const char TEXT_NBR[] PROGMEM;
extern const char TEXT_NLBR[] PROGMEM;
extern const char TEXT_NOP[] PROGMEM;
extern const char TEXT_OR[] PROGMEM;
extern const char TEXT_ORI[] PROGMEM;
extern const char TEXT_OUT[] PROGMEM;
using common::TEXT_NOP;
using common::TEXT_OR;
using common::TEXT_ORI;
using common::TEXT_OUT;
extern const char TEXT_PHI[] PROGMEM;
extern const char TEXT_PLO[] PROGMEM;
extern const char TEXT_REQ[] PROGMEM;
extern const char TEXT_RET[] PROGMEM;
using common::TEXT_RET;
extern const char TEXT_RSHL[] PROGMEM;
extern const char TEXT_RSHR[] PROGMEM;
extern const char TEXT_SAV[] PROGMEM;
extern const char TEXT_SD[] PROGMEM;
using common::TEXT_SD;
extern const char TEXT_SDB[] PROGMEM;
extern const char TEXT_SDBI[] PROGMEM;
extern const char TEXT_SDI[] PROGMEM;
extern const char TEXT_SEP[] PROGMEM;
extern const char TEXT_SEQ[] PROGMEM;
extern const char TEXT_SEX[] PROGMEM;
extern const char TEXT_SHL[] PROGMEM;
using common::TEXT_SEP;
using common::TEXT_SEQ;
using common::TEXT_SEX;
using common::TEXT_SHL;
extern const char TEXT_SHLC[] PROGMEM;
extern const char TEXT_SHR[] PROGMEM;
using common::TEXT_SHR;
extern const char TEXT_SHRC[] PROGMEM;
using common::TEXT_SKP;
extern const char TEXT_SM[] PROGMEM;
using common::TEXT_SM;
extern const char TEXT_SMB[] PROGMEM;
extern const char TEXT_SMBI[] PROGMEM;
extern const char TEXT_SMI[] PROGMEM;
extern const char TEXT_STR[] PROGMEM;
using common::TEXT_SMI;
using common::TEXT_STR;
extern const char TEXT_STXD[] PROGMEM;
extern const char TEXT_XOR[] PROGMEM;
extern const char TEXT_XRI[] PROGMEM;
using common::TEXT_XOR;
using common::TEXT_XRI;

// CDP1804
extern const char TEXT_BCI[] PROGMEM;
Expand All @@ -130,7 +130,7 @@ extern const char TEXT_CIE[] PROGMEM;
extern const char TEXT_DTC[] PROGMEM;
extern const char TEXT_ETQ[] PROGMEM;
extern const char TEXT_GEC[] PROGMEM;
extern const char TEXT_LDC[] PROGMEM;
using common::TEXT_LDC;
extern const char TEXT_RLDI[] PROGMEM;
extern const char TEXT_RLXA[] PROGMEM;
extern const char TEXT_RNX[] PROGMEM;
Expand Down
24 changes: 12 additions & 12 deletions src/text_f3850.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,33 @@ constexpr char TEXT_BR7[] PROGMEM = "BR7";
// constexpr char TEXT_COM[] PROGMEM = "COM";
constexpr char TEXT_DCI[] PROGMEM = "DCI";
// constexpr char TEXT_DI[] PROGMEM = "DI";
constexpr char TEXT_DS[] PROGMEM = "DS";
// constexpr char TEXT_DS[] PROGMEM = "DS";
// constexpr char TEXT_EI[] PROGMEM = "EI";
// constexpr char TEXT_IN[] PROGMEM = "IN";
// constexpr char TEXT_INC[] PROGMEM = "INC";
// constexpr char TEXT_INS[] PROGMEM = "INS";
constexpr char TEXT_JMP[] PROGMEM = "JMP";
constexpr char TEXT_LI[] PROGMEM = "LI";
// constexpr char TEXT_JMP[] PROGMEM = "JMP";
// constexpr char TEXT_LI[] PROGMEM = "LI";
constexpr char TEXT_LIS[] PROGMEM = "LIS";
constexpr char TEXT_LISL[] PROGMEM = "LISL";
constexpr char TEXT_LISU[] PROGMEM = "LISU";
constexpr char TEXT_LM[] PROGMEM = "LM";
constexpr char TEXT_LNK[] PROGMEM = "LNK";
constexpr char TEXT_LR[] PROGMEM = "LR";
// constexpr char TEXT_LR[] PROGMEM = "LR";
constexpr char TEXT_NI[] PROGMEM = "NI";
constexpr char TEXT_NM[] PROGMEM = "NM";
constexpr char TEXT_NOP[] PROGMEM = "NOP";
// constexpr char TEXT_NOP[] PROGMEM = "NOP";
constexpr char TEXT_NS[] PROGMEM = "NS";
constexpr char TEXT_OI[] PROGMEM = "OI";
constexpr char TEXT_OM[] PROGMEM = "OM";
constexpr char TEXT_OUT[] PROGMEM = "OUT";
constexpr char TEXT_OUTS[] PROGMEM = "OUTS";
// constexpr char TEXT_OUT[] PROGMEM = "OUT";
// constexpr char TEXT_OUTS[] PROGMEM = "OUTS";
constexpr char TEXT_PI[] PROGMEM = "PI";
constexpr char TEXT_PK[] PROGMEM = "PK";
constexpr char TEXT_POP[] PROGMEM = "POP";
constexpr char TEXT_SL[] PROGMEM = "SL";
constexpr char TEXT_SR[] PROGMEM = "SR";
constexpr char TEXT_ST[] PROGMEM = "ST";
// constexpr char TEXT_POP[] PROGMEM = "POP";
// constexpr char TEXT_SL[] PROGMEM = "SL";
// constexpr char TEXT_SR[] PROGMEM = "SR";
// constexpr char TEXT_ST[] PROGMEM = "ST";
constexpr char TEXT_XDC[] PROGMEM = "XDC";
constexpr char TEXT_XI[] PROGMEM = "XI";
constexpr char TEXT_XM[] PROGMEM = "XM";
Expand All @@ -94,7 +94,7 @@ constexpr char TEXT_REG_J[] PROGMEM = "J";
constexpr char TEXT_REG_KL[] PROGMEM = "KL";
constexpr char TEXT_REG_K[] PROGMEM = "K";
constexpr char TEXT_REG_KU[] PROGMEM = "KU";
constexpr char TEXT_REG_P0[] PROGMEM = "P0";
// constexpr char TEXT_REG_P0[] PROGMEM = "P0";
// constexpr char TEXT_REG_P[] PROGMEM = "P";
constexpr char TEXT_REG_QL[] PROGMEM = "QL";
constexpr char TEXT_REG_Q[] PROGMEM = "Q";
Expand Down
24 changes: 12 additions & 12 deletions src/text_f3850.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,33 @@ using common::TEXT_CM;
using common::TEXT_COM;
extern const char TEXT_DCI[] PROGMEM;
using common::TEXT_DI;
extern const char TEXT_DS[] PROGMEM;
using common::TEXT_DS;
using common::TEXT_EI;
using common::TEXT_IN;
using common::TEXT_INC;
using common::TEXT_INS;
extern const char TEXT_JMP[] PROGMEM;
extern const char TEXT_LI[] PROGMEM;
using common::TEXT_JMP;
using common::TEXT_LI;
extern const char TEXT_LIS[] PROGMEM;
extern const char TEXT_LISL[] PROGMEM;
extern const char TEXT_LISU[] PROGMEM;
extern const char TEXT_LM[] PROGMEM;
extern const char TEXT_LNK[] PROGMEM;
extern const char TEXT_LR[] PROGMEM;
using common::TEXT_LR;
extern const char TEXT_NI[] PROGMEM;
extern const char TEXT_NM[] PROGMEM;
extern const char TEXT_NOP[] PROGMEM;
using common::TEXT_NOP;
extern const char TEXT_NS[] PROGMEM;
extern const char TEXT_OI[] PROGMEM;
extern const char TEXT_OM[] PROGMEM;
extern const char TEXT_OUT[] PROGMEM;
extern const char TEXT_OUTS[] PROGMEM;
using common::TEXT_OUT;
using common::TEXT_OUTS;
extern const char TEXT_PI[] PROGMEM;
extern const char TEXT_PK[] PROGMEM;
extern const char TEXT_POP[] PROGMEM;
extern const char TEXT_SL[] PROGMEM;
extern const char TEXT_SR[] PROGMEM;
extern const char TEXT_ST[] PROGMEM;
using common::TEXT_POP;
using common::TEXT_SL;
using common::TEXT_SR;
using common::TEXT_ST;
extern const char TEXT_XDC[] PROGMEM;
extern const char TEXT_XI[] PROGMEM;
extern const char TEXT_XM[] PROGMEM;
Expand All @@ -98,7 +98,7 @@ extern const char TEXT_REG_KL[] PROGMEM;
extern const char TEXT_REG_K[] PROGMEM;
extern const char TEXT_REG_KU[] PROGMEM;
using common::TEXT_REG_P;
extern const char TEXT_REG_P0[] PROGMEM;
using common::TEXT_REG_P0;
extern const char TEXT_REG_QL[] PROGMEM;
extern const char TEXT_REG_Q[] PROGMEM;
extern const char TEXT_REG_QU[] PROGMEM;
Expand Down
2 changes: 1 addition & 1 deletion src/text_i8096.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ constexpr char TEXT_NORML[] PROGMEM = "NORML";
// constexpr char TEXT_NOTB[] PROGMEM = "NOTB";
// constexpr char TEXT_OR[] PROGMEM = "OR";
// constexpr char TEXT_ORB[] PROGMEM = "ORB";
constexpr char TEXT_ORG[] PROGMEM = "ORG";
// constexpr char TEXT_ORG[] PROGMEM = "ORG";
// constexpr char TEXT_POP[] PROGMEM = "POP";
// constexpr char TEXT_POPF[] PROGMEM = "POPF";
// constexpr char TEXT_PUSH[] PROGMEM = "PUSH";
Expand Down
2 changes: 1 addition & 1 deletion src/text_i8096.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ using common::TEXT_NOT;
using common::TEXT_NOTB;
using common::TEXT_OR;
using common::TEXT_ORB;
extern const char TEXT_ORG[] PROGMEM;
using common::TEXT_ORG;
using common::TEXT_POP;
using common::TEXT_POPF;
using common::TEXT_PUSH;
Expand Down
2 changes: 1 addition & 1 deletion src/text_mc6800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ constexpr char TEXT_ABY[] PROGMEM = "ABY";
// constexpr char TEXT_CPD[] PROGMEM = "CPD";
// constexpr char TEXT_CPY[] PROGMEM = "CPY";
// constexpr char TEXT_DEY[] PROGMEM = "DEY";
constexpr char TEXT_FDIV[] PROGMEM = "FDIV";
// constexpr char TEXT_FDIV[] PROGMEM = "FDIV";
// constexpr char TEXT_IDIV[] PROGMEM = "IDIV";
// constexpr char TEXT_INY[] PROGMEM = "INY";
// constexpr char TEXT_LDY[] PROGMEM = "LDY";
Expand Down
2 changes: 1 addition & 1 deletion src/text_mc6800.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ using common::TEXT_BRSET;
using common::TEXT_CPD;
using common::TEXT_CPY;
using common::TEXT_DEY;
extern const char TEXT_FDIV[] PROGMEM;
using common::TEXT_FDIV;
using common::TEXT_IDIV;
using common::TEXT_INY;
using common::TEXT_LDY;
Expand Down
4 changes: 2 additions & 2 deletions src/text_mc6809.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ constexpr char TEXT_TSTW[] PROGMEM = "TSTW";
// constexpr char TEXT_REG_A[] PROGMEM = "A";
// constexpr char TEXT_REG_B[] PROGMEM = "B";
// constexpr char TEXT_REG_D[] PROGMEM = "D";
constexpr char TEXT_REG_X[] PROGMEM = "X";
constexpr char TEXT_REG_Y[] PROGMEM = "Y";
// constexpr char TEXT_REG_X[] PROGMEM = "X";
// constexpr char TEXT_REG_Y[] PROGMEM = "Y";
constexpr char TEXT_REG_U[] PROGMEM = "U";
// constexpr char TEXT_REG_S[] PROGMEM = "S";
// constexpr char TEXT_REG_PC[] PROGMEM = "PC";
Expand Down
4 changes: 2 additions & 2 deletions src/text_mc6809.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ extern const char TEXT_TSTW[] PROGMEM;
using common::TEXT_REG_A;
using common::TEXT_REG_B;
using common::TEXT_REG_D;
extern const char TEXT_REG_X[] PROGMEM;
extern const char TEXT_REG_Y[] PROGMEM;
using common::TEXT_REG_X;
using common::TEXT_REG_Y;
extern const char TEXT_REG_U[] PROGMEM;
using common::TEXT_REG_S;
using common::TEXT_REG_PC;
Expand Down
14 changes: 7 additions & 7 deletions src/text_pdp8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ constexpr char TEXT_CPU_6120[] PROGMEM = "6120";

// IM6100
constexpr char TEXT_ACL[] PROGMEM = "ACL";
constexpr char TEXT_AND[] PROGMEM = "AND";
// constexpr char TEXT_AND[] PROGMEM = "AND";
constexpr char TEXT_BSW[] PROGMEM = "BSW";
constexpr char TEXT_CAF[] PROGMEM = "CAF";
constexpr char TEXT_CAM[] PROGMEM = "CAM";
Expand All @@ -38,24 +38,24 @@ constexpr char TEXT_CLA[] PROGMEM = "CLA";
constexpr char TEXT_CLL[] PROGMEM = "CLL";
// constexpr char TEXT_CMA[] PROGMEM = "CMA";
constexpr char TEXT_CML[] PROGMEM = "CML";
constexpr char TEXT_CPU[] PROGMEM = "CPU";
// constexpr char TEXT_CPU[] PROGMEM = "CPU";
constexpr char TEXT_DCA[] PROGMEM = "DCA";
constexpr char TEXT_END[] PROGMEM = "END";
constexpr char TEXT_GLK[] PROGMEM = "GLK";
constexpr char TEXT_GTF[] PROGMEM = "GTF";
constexpr char TEXT_HLT[] PROGMEM = "HLT";
// constexpr char TEXT_HLT[] PROGMEM = "HLT";
constexpr char TEXT_IAC[] PROGMEM = "IAC";
constexpr char TEXT_IOF[] PROGMEM = "IOF";
constexpr char TEXT_ION[] PROGMEM = "ION";
constexpr char TEXT_IOT[] PROGMEM = "IOT";
constexpr char TEXT_ISZ[] PROGMEM = "ISZ";
constexpr char TEXT_JMP[] PROGMEM = "JMP";
// constexpr char TEXT_JMP[] PROGMEM = "JMP";
constexpr char TEXT_JMS[] PROGMEM = "JMS";
constexpr char TEXT_LAS[] PROGMEM = "LAS";
constexpr char TEXT_MQA[] PROGMEM = "MQA";
constexpr char TEXT_MQL[] PROGMEM = "MQL";
constexpr char TEXT_NOP[] PROGMEM = "NOP";
constexpr char TEXT_ORG[] PROGMEM = "ORG";
// constexpr char TEXT_NOP[] PROGMEM = "NOP";
// constexpr char TEXT_ORG[] PROGMEM = "ORG";
constexpr char TEXT_OSR[] PROGMEM = "OSR";
// constexpr char TEXT_RAL[] PROGMEM = "RAL";
// constexpr char TEXT_RAR[] PROGMEM = "RAR";
Expand All @@ -70,7 +70,7 @@ constexpr char TEXT_SNA[] PROGMEM = "SNA";
constexpr char TEXT_SNL[] PROGMEM = "SNL";
constexpr char TEXT_SPA[] PROGMEM = "SPA";
constexpr char TEXT_SRQ[] PROGMEM = "SRQ";
constexpr char TEXT_STA[] PROGMEM = "STA";
// constexpr char TEXT_STA[] PROGMEM = "STA";
constexpr char TEXT_STL[] PROGMEM = "STL";
constexpr char TEXT_SWP[] PROGMEM = "SWP";
constexpr char TEXT_SZA[] PROGMEM = "SZA";
Expand Down
Loading

0 comments on commit 06090dc

Please sign in to comment.