Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instcomp does not mangle component names with underscores #79

Open
wants to merge 2 commits into
base: disentangle-merged-into-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions configs/attic/demo_mazak/demo_mazak.hal
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ loadrt mux4 count=1
loadrt wcomp count=2
loadrt scale count=3
loadrt modmath mod_dir=2
loadrt charge_pump
newinst charge_pump charge-pump
loadrt tristate_bit
loadrt tristate_float count=3
loadrt conv_s32_float
Expand Down Expand Up @@ -162,13 +162,13 @@ addf scale.1 servo-thread
addf mux4.0 servo-thread
addf wcomp.0 servo-thread
addf wcomp.1 servo-thread
addf tristate-bit.0 servo-thread
addf tristate_bit.0 servo-thread

# misc stuff (jogwheel scale, tool number display)
addf tristate-float.0 servo-thread
addf tristate-float.1 servo-thread
addf tristate-float.2 servo-thread
addf conv-s32-float.0 servo-thread
addf tristate_float.0 servo-thread
addf tristate_float.1 servo-thread
addf tristate_float.2 servo-thread
addf conv_s32_float.0 servo-thread

# output drivers are loaded last
addf motenc.3.dac-write servo-thread
Expand Down Expand Up @@ -485,9 +485,9 @@ net magazine-rev-req-store mod-dir.1.down
# set encoder latch enable TRUE so encoder count "wraps" during toolchanges
# and resets under motion controller command for rigid tapping
net sp-index-enable motenc.3.enc-03-index-enable
net sp-index-enable tristate-bit.0.out
setp tristate-bit.0.in 1
net tool-change tristate-bit.0.enable
net sp-index-enable tristate_bit.0.out
setp tristate_bit.0.in 1
net tool-change tristate_bit.0.enable
net sp-index-enable motion.spindle-index-enable

# jogwheel signals
Expand Down
23 changes: 18 additions & 5 deletions src/emc/rs274ngc/rs274ngc_pre.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2592,16 +2592,29 @@ FILE *Interp::find_ngc_file(setup_pointer settings,const char *basename, char *f
return newFP;
}

static std::set<std::string> stringtable;

struct StrcmpComparator
{
bool operator()(const char * A, const char * B) const
{
return (strcmp(A, B) < 0) ;
}
} ;

static std::set<const char *, StrcmpComparator> stringtable;

const char *strstore(const char *s)
{
using namespace std;

if (s == NULL)
throw invalid_argument("strstore(): NULL argument");
pair< set<string>::iterator, bool > pair = stringtable.insert(s);
return string(*pair.first).c_str();
}


std::set<const char *, StrcmpComparator>::iterator it = stringtable.find(s);
if (it == stringtable.end()) {
const char *p = strdup(s);
stringtable.insert(p);
return p;
}
return (*it);
}