From f98dd37e49d0c9efcf302c05a5292fa94acbed6a Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 16 Sep 2024 13:43:52 -0400 Subject: [PATCH] Changed all references to 'subnet' to 'user_def_proc' or UDP. --- cwFlow.cpp | 134 ++++++++++++------------- cwFlow.h | 8 +- cwFlowNet.cpp | 2 +- cwFlowNet.h | 8 +- cwFlowProc.cpp | 6 +- cwFlowProc.h | 2 +- cwFlowTypes.cpp | 12 +-- cwFlowTypes.h | 6 +- cwIoFlowCtl.cpp | 18 ++-- flow/{subnet_dict.cfg => udp_dict.cfg} | 0 10 files changed, 98 insertions(+), 98 deletions(-) rename flow/{subnet_dict.cfg => udp_dict.cfg} (100%) diff --git a/cwFlow.cpp b/cwFlow.cpp index 51b6481..38fe61f 100644 --- a/cwFlow.cpp +++ b/cwFlow.cpp @@ -30,7 +30,7 @@ namespace cw } library_t; library_t g_library[] = { - { "subnet", &subnet::members }, + { "user_def_proc", &user_def_proc::members }, { "poly", &poly::members }, { "midi_in", &midi_in::members }, { "midi_out", &midi_out::members }, @@ -115,7 +115,7 @@ namespace cw return rc; } - rc_t _parse_subnet_var_proxy_string( const char* proxyStr, var_desc_t* var_desc ) + rc_t _parse_udp_var_proxy_string( const char* proxyStr, var_desc_t* var_desc ) { rc_t rc = kOkRC; @@ -246,7 +246,7 @@ namespace cw // parse the proxy string into it's two parts: . if( proxy_string != nullptr ) { - if((rc = _parse_subnet_var_proxy_string( proxy_string, vd )) != kOkRC ) + if((rc = _parse_udp_var_proxy_string( proxy_string, vd )) != kOkRC ) goto errLabel; } @@ -366,12 +366,12 @@ namespace cw if( vd->proxyProcLabel != nullptr || vd->proxyVarLabel != nullptr ) { - cwLogWarning("The 'proxy' field in the variable description '%s' on class description '%s' will be ignored because the variable is not part of a subnet definition.",cwStringNullGuard(vd->label),cwStringNullGuard(cd->label)); + cwLogWarning("The 'proxy' field in the variable description '%s' on class description '%s' will be ignored because the variable is not part of a UDP definition.",cwStringNullGuard(vd->label),cwStringNullGuard(cd->label)); } - if( cwIsFlag(vd->flags,kSubnetOutVarDescFl ) ) + if( cwIsFlag(vd->flags,kUdpOutVarDescFl ) ) { - cwLogWarning("The 'out' flag in the variable description '%s' on class description '%s' will be ignored because the variable is not part of a subnet definition.",cwStringNullGuard(vd->label),cwStringNullGuard(cd->label)); + cwLogWarning("The 'out' flag in the variable description '%s' on class description '%s' will be ignored because the variable is not part of a UDP definition.",cwStringNullGuard(vd->label),cwStringNullGuard(cd->label)); } vd->link = cd->varDescL; @@ -385,7 +385,7 @@ namespace cw return rc; } - rc_t _find_subnet_proc_class_desc( flow_t* p, const object_t* subnetProcD, const char* procInstLabel, const class_desc_t*& class_desc_ref ) + rc_t _find_udp_proc_class_desc( flow_t* p, const object_t* udpProcD, const char* procInstLabel, const class_desc_t*& class_desc_ref ) { rc_t rc = kOkRC; const object_t* procInstD = nullptr; @@ -394,10 +394,10 @@ namespace cw class_desc_ref = nullptr; - // find the proc inst dict in the subnet - if((procInstD = subnetProcD->find_child(procInstLabel)) == nullptr ) + // find the proc inst dict in the UDP + if((procInstD = udpProcD->find_child(procInstLabel)) == nullptr ) { - rc = cwLogError(kSyntaxErrorRC,"The proc instance '%s' from the proxy var list could not be foud in the subnet.",cwStringNullGuard(procInstLabel)); + rc = cwLogError(kSyntaxErrorRC,"The proc instance '%s' from the proxy var list could not be foud in the UDP.",cwStringNullGuard(procInstLabel)); goto errLabel; } @@ -421,7 +421,7 @@ namespace cw } - rc_t _create_subnet_var_desc( flow_t* p, class_desc_t* subnetClassDesc, const object_t* subnetProcD, const object_t* varDescPair, var_desc_t*& vd_ref ) + rc_t _create_udp_var_desc( flow_t* p, class_desc_t* udpClassDesc, const object_t* udpProcD, const object_t* varDescPair, var_desc_t*& vd_ref ) { rc_t rc = kOkRC; const class_desc_t* proxy_class_desc = nullptr; @@ -431,25 +431,25 @@ namespace cw vd_ref = nullptr; // parse the variable descripiton and create a var_desc_t record - if((rc = _parse_class_var_cfg(p, subnetClassDesc, varDescPair, var_desc )) != kOkRC ) + if((rc = _parse_class_var_cfg(p, udpClassDesc, varDescPair, var_desc )) != kOkRC ) { goto errLabel; } if( var_desc->type != 0 ) { - cwLogWarning("The 'type' field int the variable description '%s' on the class description '%s' will be ignored because the variable is proxied.",cwStringNullGuard(subnetClassDesc->label),cwStringNullGuard(var_desc->label)); + cwLogWarning("The 'type' field int the variable description '%s' on the class description '%s' will be ignored because the variable is proxied.",cwStringNullGuard(udpClassDesc->label),cwStringNullGuard(var_desc->label)); } // verify that a proxy-proc-label and proxy-var-label were specified in the variable descripiton if( var_desc->proxyProcLabel == nullptr || var_desc->proxyVarLabel == nullptr ) { - rc = cwLogError(kSyntaxErrorRC,"The subnet variable description '%s' in the subnet '%s' must have a valid 'proxy' field.",cwStringNullGuard(var_desc->label),cwStringNullGuard(subnetClassDesc->label)); + rc = cwLogError(kSyntaxErrorRC,"The UDP variable description '%s' in the UDP '%s' must have a valid 'proxy' field.",cwStringNullGuard(var_desc->label),cwStringNullGuard(udpClassDesc->label)); goto errLabel; } // locate the class desc associated with proxy proc - if((rc = _find_subnet_proc_class_desc( p, subnetProcD, var_desc->proxyProcLabel, proxy_class_desc )) != kOkRC ) + if((rc = _find_udp_proc_class_desc( p, udpProcD, var_desc->proxyProcLabel, proxy_class_desc )) != kOkRC ) { goto errLabel; } @@ -457,17 +457,17 @@ namespace cw // locate the var desc associated with the proxy proc var if((proxy_var_desc = var_desc_find( proxy_class_desc, var_desc->proxyVarLabel)) == nullptr ) { - rc = cwLogError(kEleNotFoundRC,"The subnet proxied variable desc '%s.%s' could not be found in subnet '%s'.",cwStringNullGuard(var_desc->proxyProcLabel),cwStringNullGuard(var_desc->proxyVarLabel),cwStringNullGuard(subnetClassDesc->label)); + rc = cwLogError(kEleNotFoundRC,"The UDP proxied variable desc '%s.%s' could not be found in UDP '%s'.",cwStringNullGuard(var_desc->proxyProcLabel),cwStringNullGuard(var_desc->proxyVarLabel),cwStringNullGuard(udpClassDesc->label)); goto errLabel; } - // get the subnet var_desc type from the proxied var_desc + // get the UDP var_desc type from the proxied var_desc var_desc->type = proxy_var_desc->type; - // augment the subnet var_desc flags from the proxied var_desc + // augment the udp var_desc flags from the proxied var_desc var_desc->flags |= proxy_var_desc->flags; - // if no default value was given to the subnet var desc then get it from the proxied var desc + // if no default value was given to the UDP var desc then get it from the proxied var desc if( var_desc->val_cfg == nullptr ) var_desc->val_cfg = proxy_var_desc->val_cfg; @@ -484,7 +484,7 @@ namespace cw return rc; } - rc_t _parse_subnet_vars( flow_t* p, class_desc_t* class_desc, const object_t* subnetProcD, const object_t* varD ) + rc_t _parse_udp_vars( flow_t* p, class_desc_t* class_desc, const object_t* udpProcD, const object_t* varD ) { rc_t rc = kOkRC; @@ -498,13 +498,13 @@ namespace cw varN = varD->child_count(); - // Fill the class_Desc.varDescL list from the subnet 'vars' dictioanry + // Fill the class_Desc.varDescL list from the UDP 'vars' dictioanry for(unsigned i=0; ichild_ele(i); var_desc_t* var_desc = nullptr; - if((rc = _create_subnet_var_desc( p, class_desc, subnetProcD, child_pair, var_desc )) != kOkRC ) + if((rc = _create_udp_var_desc( p, class_desc, udpProcD, child_pair, var_desc )) != kOkRC ) goto errLabel; @@ -519,104 +519,104 @@ namespace cw return rc; } - rc_t _create_subnet_class_desc( flow_t* p, const object_t* class_obj, class_desc_t* class_desc ) + rc_t _create_udp_class_desc( flow_t* p, const object_t* class_obj, class_desc_t* class_desc ) { rc_t rc = kOkRC; const object_t* varD = nullptr; - const object_t* subnetD = nullptr; - const object_t* subnetProcD = nullptr; - const object_t* subnetPresetD = nullptr; - const char* subnetProcDescLabel = nullptr; + const object_t* udpD = nullptr; + const object_t* udpProcD = nullptr; + const object_t* udpPresetD = nullptr; + const char* udpProcDescLabel = nullptr; - // Validate the subnet proc desc label and value - if( class_obj==nullptr || !class_obj->is_pair() || class_obj->pair_value()==nullptr || !class_obj->pair_value()->is_dict() || (subnetProcDescLabel = class_obj->pair_label()) == nullptr ) + // Validate the UDP proc desc label and value + if( class_obj==nullptr || !class_obj->is_pair() || class_obj->pair_value()==nullptr || !class_obj->pair_value()->is_dict() || (udpProcDescLabel = class_obj->pair_label()) == nullptr ) { - rc = cwLogError(kInvalidArgRC,"An invalid subnet description '%s' was encountered.",cwStringNullGuard(subnetProcDescLabel)); + rc = cwLogError(kInvalidArgRC,"An invalid UDP description '%s' was encountered.",cwStringNullGuard(udpProcDescLabel)); goto errLabel; } - // verify that another subnet with the same name does not already exist - if( class_desc_find(p,subnetProcDescLabel) != nullptr ) + // verify that another UDP with the same name does not already exist + if( class_desc_find(p,udpProcDescLabel) != nullptr ) { - rc = cwLogError(kInvalidStateRC,"A subnet named '%s' already exists.",subnetProcDescLabel); + rc = cwLogError(kInvalidStateRC,"A UDP named '%s' already exists.",udpProcDescLabel); goto errLabel; } class_desc->cfg = class_obj->pair_value(); class_desc->label = class_obj->pair_label(); - // get the 'subnet' members record - if((class_desc->members = _find_library_record("subnet")) == nullptr ) + // get the 'UDP' members record + if((class_desc->members = _find_library_record("user_def_proc")) == nullptr ) { - rc = cwLogError(kSyntaxErrorRC,"The 'subnet' class member function record could not be found." ); + rc = cwLogError(kSyntaxErrorRC,"The 'UDP' class member function record could not be found." ); goto errLabel; } // get the variable description if((rc = class_desc->cfg->getv_opt("vars", varD, - "network", subnetD)) != kOkRC ) + "network", udpD)) != kOkRC ) { - rc = cwLogError(rc,"Parse failed while parsing subnet desc:'%s'", cwStringNullGuard(class_desc->label) ); + rc = cwLogError(rc,"Parse failed while parsing UDP desc:'%s'", cwStringNullGuard(class_desc->label) ); goto errLabel; } - // get the subnet proc and preset dictionaries - if((rc = subnetD->getv("procs", subnetProcD, - "presets", subnetPresetD)) != kOkRC ) + // get the UDP proc and preset dictionaries + if((rc = udpD->getv("procs", udpProcD, + "presets", udpPresetD)) != kOkRC ) { rc = cwLogError(rc,"Parse failed on the 'network' element."); goto errLabel; } - // fill class_desc.varDescL from the subnet vars dictionary - if((rc = _parse_subnet_vars( p, class_desc, subnetProcD, varD )) != kOkRC ) + // fill class_desc.varDescL from the UDP vars dictionary + if((rc = _parse_udp_vars( p, class_desc, udpProcD, varD )) != kOkRC ) { - rc = cwLogError(rc,"Subnet 'vars' processing failed."); + rc = cwLogError(rc,"UDP 'vars' processing failed."); goto errLabel; } errLabel: if(rc != kOkRC ) - rc = cwLogError(rc,"'proc' class description creation failed for the subnet '%s'. ",cwStringNullGuard(subnetProcDescLabel)); + rc = cwLogError(rc,"'proc' class description creation failed for the UDP '%s'. ",cwStringNullGuard(udpProcDescLabel)); return rc; } - rc_t _parse_subnet_cfg(flow_t* p, const object_t* subnetCfg) + rc_t _parse_udp_cfg(flow_t* p, const object_t* udpCfg) { rc_t rc = kOkRC; - if( !subnetCfg->is_dict() ) - return cwLogError(kSyntaxErrorRC,"The subnet class description dictionary does not have dictionary syntax."); + if( !udpCfg->is_dict() ) + return cwLogError(kSyntaxErrorRC,"The UDP class description dictionary does not have dictionary syntax."); - unsigned subnetDescN = subnetCfg->child_count(); - p->subnetDescA = mem::allocZ( subnetDescN ); + unsigned udpDescN = udpCfg->child_count(); + p->udpDescA = mem::allocZ( udpDescN ); - // for each subnet description - for(unsigned i=0; ichild_ele(i); + const object_t* udp_obj = udpCfg->child_ele(i); - if((rc = _create_subnet_class_desc(p, subnet_obj, p->subnetDescA + i )) != kOkRC ) + if((rc = _create_udp_class_desc(p, udp_obj, p->udpDescA + i )) != kOkRC ) { - rc = cwLogError(rc,"Subnet class description create failed on the subnet at index:%i.",i); + rc = cwLogError(rc,"UDP class description create failed on the UDP at index:%i.",i); goto errLabel; } - // We have to update the size of the subnet class array - // as we go because we may want be able to search p->subnetDescA[] + // We have to update the size of the UDP class array + // as we go because we may want be able to search p->udpDescA[] // aand to do that we must now the current length. - p->subnetDescN += 1; + p->udpDescN += 1; } - assert( subnetDescN == p->subnetDescN ); + assert( udpDescN == p->udpDescN ); errLabel: if( rc != kOkRC ) { - rc = cwLogError(rc,"Subnet processing failed."); + rc = cwLogError(rc,"UDP processing failed."); } @@ -646,9 +646,9 @@ namespace cw network_destroy(p->net); _release_class_desc_array(p->classDescA,p->classDescN); - _release_class_desc_array(p->subnetDescA,p->subnetDescN); + _release_class_desc_array(p->udpDescA,p->udpDescN); p->classDescN = 0; - p->subnetDescN = 0; + p->udpDescN = 0; mem::release(p); @@ -676,7 +676,7 @@ void cw::flow::print_external_device( const external_device_t* dev ) cw::rc_t cw::flow::create( handle_t& hRef, const object_t* classCfg, const object_t* flowCfg, - const object_t* subnetCfg, + const object_t* udpCfg, const char* proj_dir ) { rc_t rc = kOkRC; @@ -696,11 +696,11 @@ cw::rc_t cw::flow::create( handle_t& hRef, goto errLabel; } - // parse the subnet descriptions - if( subnetCfg != nullptr ) - if((rc = _parse_subnet_cfg(p,subnetCfg)) != kOkRC ) + // parse the UDP descriptions + if( udpCfg != nullptr ) + if((rc = _parse_udp_cfg(p,udpCfg)) != kOkRC ) { - rc = cwLogError(kSyntaxErrorRC,"Error parsing the subnet list."); + rc = cwLogError(kSyntaxErrorRC,"Error parsing the UDP list."); goto errLabel; } diff --git a/cwFlow.h b/cwFlow.h index 318444b..c6e87a4 100644 --- a/cwFlow.h +++ b/cwFlow.h @@ -16,10 +16,10 @@ namespace cw // query the network for configuration information which can // be used to setup the extern_device_t array. rc_t create(handle_t& hRef, - const object_t* classCfg, - const object_t* networkCfg, - const object_t* subnetCfg = nullptr, - const char* projDir = nullptr); + const object_t* classCfg, + const object_t* networkCfg, + const object_t* udpCfg = nullptr, + const char* projDir = nullptr); // Instantiate the network and prepare for runtime. rc_t initialize( handle_t handle, diff --git a/cwFlowNet.cpp b/cwFlowNet.cpp index cd8fbe3..e290304 100644 --- a/cwFlowNet.cpp +++ b/cwFlowNet.cpp @@ -1179,7 +1179,7 @@ namespace cw var->flags |= kProxiedVarFl; - if( cwIsFlag(wrap_var->varDesc->flags,kSubnetOutVarDescFl) ) + if( cwIsFlag(wrap_var->varDesc->flags,kUdpOutVarDescFl) ) var->flags |= kProxiedOutVarFl; } } diff --git a/cwFlowNet.h b/cwFlowNet.h index eb26860..dc20a96 100644 --- a/cwFlowNet.h +++ b/cwFlowNet.h @@ -6,10 +6,10 @@ namespace cw namespace flow { rc_t network_create( flow_t* p, - const object_t* networkCfg, - network_t& net, // Network object to be filled with new proc instances - variable_t* proxyVarL, // - unsigned polyCnt = 1 // Count of networks to create + const object_t* subnetCfgA, // subnetCfgA[subNetCfgN] per subnet cfg record + network_t& net, // Network object to be filled with new proc instances + variable_t* proxyVarL, // + unsigned polyCnt = 1 // Count of networks to create ); rc_t network_destroy( network_t& net ); diff --git a/cwFlowProc.cpp b/cwFlowProc.cpp index a74269f..cda9f85 100644 --- a/cwFlowProc.cpp +++ b/cwFlowProc.cpp @@ -135,9 +135,9 @@ namespace cw //------------------------------------------------------------------------------------------------------------------ // - // subnet + // user_def_proc // - namespace subnet + namespace user_def_proc { typedef struct { @@ -152,7 +152,7 @@ namespace cw if((rc = proc->class_desc->cfg->getv("network",networkCfg)) != kOkRC ) { - rc = cwLogError(rc,"The subnet 'network' cfg. was not found."); + rc = cwLogError(rc,"The UDP 'network' cfg. was not found."); goto errLabel; } diff --git a/cwFlowProc.h b/cwFlowProc.h index 96aed14..3ec8641 100644 --- a/cwFlowProc.h +++ b/cwFlowProc.h @@ -2,7 +2,7 @@ namespace cw { namespace flow { - namespace subnet { extern class_members_t members; } + namespace user_def_proc { extern class_members_t members; } namespace poly { extern class_members_t members; } namespace midi_in { extern class_members_t members; } namespace midi_out { extern class_members_t members; } diff --git a/cwFlowTypes.cpp b/cwFlowTypes.cpp index ce40ba6..a36c360 100644 --- a/cwFlowTypes.cpp +++ b/cwFlowTypes.cpp @@ -29,7 +29,7 @@ namespace cw { kNoSrcVarDescFl, "no_src" }, { kInitVarDescFl, "init" }, { kMultVarDescFl, "mult" }, - { kSubnetOutVarDescFl, "out" }, + { kUdpOutVarDescFl, "out" }, { kInvalidVarDescFl, "" } }; @@ -1533,9 +1533,9 @@ cw::flow::class_desc_t* cw::flow::class_desc_find( flow_t* p, const char* label if( textIsEqual(p->classDescA[i].label,label)) return p->classDescA + i; - for(unsigned i=0; isubnetDescN; ++i) - if( textIsEqual(p->subnetDescA[i].label,label)) - return p->subnetDescA + i; + for(unsigned i=0; iudpDescN; ++i) + if( textIsEqual(p->udpDescA[i].label,label)) + return p->udpDescA + i; return nullptr; } @@ -1577,8 +1577,8 @@ void cw::flow::class_dict_print( flow_t* p ) for(unsigned i=0; iclassDescN; ++i) _class_desc_print(p->classDescA+i); - for(unsigned i=0; isubnetDescN; ++i) - _class_desc_print(p->subnetDescA+i); + for(unsigned i=0; iudpDescN; ++i) + _class_desc_print(p->udpDescA+i); } diff --git a/cwFlowTypes.h b/cwFlowTypes.h index 7c86e1b..0b92c4a 100644 --- a/cwFlowTypes.h +++ b/cwFlowTypes.h @@ -140,7 +140,7 @@ namespace cw kNoSrcVarDescFl = 0x04, kInitVarDescFl = 0x08, kMultVarDescFl = 0x10, - kSubnetOutVarDescFl = 0x20 + kUdpOutVarDescFl = 0x20 }; typedef struct class_members_str @@ -374,8 +374,8 @@ namespace cw class_desc_t* classDescA; // unsigned classDescN; // - class_desc_t* subnetDescA; // - unsigned subnetDescN; // + class_desc_t* udpDescA; // + unsigned udpDescN; // external_device_t* deviceA; // deviceA[ deviceN ] external device description array unsigned deviceN; // diff --git a/cwIoFlowCtl.cpp b/cwIoFlowCtl.cpp index e940c74..09b19dc 100644 --- a/cwIoFlowCtl.cpp +++ b/cwIoFlowCtl.cpp @@ -63,7 +63,7 @@ namespace cw { const char* base_dir; object_t* proc_class_dict_cfg; - object_t* subnet_dict_cfg; + object_t* udp_dict_cfg; io::handle_t ioH; @@ -137,8 +137,8 @@ namespace cw if( p->proc_class_dict_cfg != nullptr ) p->proc_class_dict_cfg->free(); - if( p->subnet_dict_cfg != nullptr ) - p->subnet_dict_cfg->free(); + if( p->udp_dict_cfg != nullptr ) + p->udp_dict_cfg->free(); _program_unload(p); p->pgmN = 0; @@ -165,14 +165,14 @@ namespace cw { rc_t rc = kOkRC; const char* proc_cfg_fname = nullptr; - const char* subnet_cfg_fname = nullptr; + const char* udp_cfg_fname = nullptr; const char* io_cfg_fname = nullptr; const object_t* pgmL = nullptr; // parse the cfg parameters if((rc = cfg->readv("base_dir", kReqFl, p->base_dir, "proc_dict", kReqFl, proc_cfg_fname, - "subnet_dict", kReqFl, subnet_cfg_fname, + "udp_dict", kReqFl, udp_cfg_fname, "io_dict", kOptFl, io_cfg_fname, "programs", kDictTId, pgmL)) != kOkRC ) { @@ -187,10 +187,10 @@ namespace cw goto errLabel; } - // parse the subnet dict file - if((rc = objectFromFile(subnet_cfg_fname,p->subnet_dict_cfg)) != kOkRC ) + // parse the udp dict file + if((rc = objectFromFile(udp_cfg_fname,p->udp_dict_cfg)) != kOkRC ) { - rc = cwLogError(rc,"The flow subnet dictionary could not be read from '%s'.",cwStringNullGuard(subnet_cfg_fname)); + rc = cwLogError(rc,"The flow user-defined-proc dictionary could not be read from '%s'.",cwStringNullGuard(udp_cfg_fname)); goto errLabel; } @@ -627,7 +627,7 @@ cw::rc_t cw::io_flow_ctl::program_load( handle_t h, unsigned pgm_idx ) if((rc = create( p->flowH, p->proc_class_dict_cfg, p->pgmA[ pgm_idx ].cfg, - p->subnet_dict_cfg, + p->udp_dict_cfg, p->proj_dir )) != kOkRC ) { rc = cwLogError(rc,"Network configuration failed."); diff --git a/flow/subnet_dict.cfg b/flow/udp_dict.cfg similarity index 100% rename from flow/subnet_dict.cfg rename to flow/udp_dict.cfg