version 1.48 | version 1.49 |
---|
| |
## VND -- Visual Neuronal Dynamics I/O, parsing, selection, and data storage | ## VND -- Visual Neuronal Dynamics I/O, parsing, selection, and data storage |
## | ## |
## $Id: vnd_read.tcl,v 1.48 2025/06/30 23:56:37 barryi Exp $ | ## $Id: vnd_read.tcl,v 1.49 2025/07/25 18:54:27 barryi Exp $ |
## | ## |
## | ## |
## Home Page | ## Home Page |
| |
# filter a list of globalNodeId | # filter a list of globalNodeId |
variable node | variable node |
variable typeHash | variable typeHash |
puts "in model_type_select_list, comp_op=$comp_op comp_val=$comp_val" | #puts "in model_type_select_list, comp_op=$comp_op comp_val=$comp_val" |
set outList "" | set outList "" |
#for now, we ignore comp_op (eq,gt,lt are all taken as eq) | #for now, we ignore comp_op (eq,gt,lt are all taken as eq) |
#XX generate error message for comparator that is not == (eq). This includes the generating error for the != (neq) symbol | #XX generate error message for comparator that is not == (eq). This includes the generating error for the != (neq) symbol |
| |
set e3 [lindex $e 3] | set e3 [lindex $e 3] |
set e4 [lindex $e 4] | set e4 [lindex $e 4] |
| |
puts "parsing: e0= $e0 e1= $e1 e2= $e2 e3= $e3 e4= $e4" | #puts "parsing: e0= $e0 e1= $e1 e2= $e2 e3= $e3 e4= $e4" |
#do substitutions for easier proc calling | #do substitutions for easier proc calling |
switch $e1 { | switch $e1 { |
"<" {set e1 "lt"} | "<" {set e1 "lt"} |
| |
foreach token [tokenize_sel_string $select_string] { | foreach token [tokenize_sel_string $select_string] { |
#send token to output if not a logical sign or parenthesis | #send token to output if not a logical sign or parenthesis |
if {![regexp [subst -nocommands -nobackslashes {^(\s*)(&&|!|\|\||\(|\))}] $token]} { | if {![regexp [subst -nocommands -nobackslashes {^(\s*)(&&|!|\|\||\(|\))}] $token]} { |
puts "add directly to output: $token" | #puts "add directly to output: $token" |
sq_push outputQueue $token | sq_push outputQueue $token |
} elseif {$token eq "("} { | } elseif {$token eq "("} { |
puts "push parenthesis to op stack" | #puts "push parenthesis to op stack" |
sq_push opStack $token | sq_push opStack $token |
} elseif {$token eq ")"} { | } elseif {$token eq ")"} { |
puts "popping op stack until left parenthesis" | puts "popping op stack until left parenthesis" |
| |
} | } |
#discard the left paren, not needed in RPN | #discard the left paren, not needed in RPN |
set discardVar [stack_pop opStack] | set discardVar [stack_pop opStack] |
puts "found parenthesis, discarded >$discardVar<" | #puts "found parenthesis, discarded >$discardVar<" |
} else { | } else { |
puts "adding operator: $token" | #puts "adding operator: $token" |
# currently, with only logic and paren, all precedence is the same, all associativity is the same | # currently, with only logic and paren, all precedence is the same, all associativity is the same |
while {[llength $opStack]} { | while {[llength $opStack]} { |
set op2 [stack_top_obj opStack] | set op2 [stack_top_obj opStack] |
if { $op2 ne "(" } { | if { $op2 ne "(" } { |
#precedence and left/right associativity checks would go here | #precedence and left/right associativity checks would go here |
puts "..popping operator $op2 to output queue" | #puts "..popping operator $op2 to output queue" |
#Since we already know we are about to pop $o2 off the stack, clearer to assign it | #Since we already know we are about to pop $o2 off the stack, clearer to assign it |
sq_push outputQueue $op2 | sq_push outputQueue $op2 |
#but we do need to pop $op2 off the stack anyway... | #but we do need to pop $op2 off the stack anyway... |
| |
} | } |
sq_push opStack $token | sq_push opStack $token |
} | } |
puts " outputQueue: >$outputQueue<\n opStack: >$opStack<" | #puts " outputQueue: >$outputQueue<\n opStack: >$opStack<" |
} | } |
puts "Now to transfer tokens from stack to output" | #puts "Now to transfer tokens from stack to output" |
# note {*} tto keep lreverse output as single items, vs. bracketed list | # note {*} tto keep lreverse output as single items, vs. bracketed list |
lappend outputQueue {*}[lreverse $opStack] | lappend outputQueue {*}[lreverse $opStack] |
puts "Now to return outputQueue= >$outputQueue<" | #puts "Now to return outputQueue= >$outputQueue<" |
return $outputQueue | return $outputQueue |
} | } |
| |
| |
puts "Now to process RPN input queue. rpn_input_queue is $rpn_input_queue" | puts "Now to process RPN input queue. rpn_input_queue is $rpn_input_queue" |
while {[llength $rpn_input_queue]} { | while {[llength $rpn_input_queue]} { |
set e [queue_pop rpn_input_queue] | set e [queue_pop rpn_input_queue] |
puts "e is >$e<" | #puts "e is >$e<" |
#puts "length of rpn_stack is [llength $rpn_stack]" | #puts "length of rpn_stack is [llength $rpn_stack]" |
switch -- $e { | switch -- $e { |
&& { puts "The && symbol was found. e= >$e<" | && { puts "The && symbol was found. e= >$e<" |
| |
mol top $molec | mol top $molec |
graphics $molec delete all | graphics $molec delete all |
| |
| # XX seems equivalent to repid, translated back again. remove this extra conversion her and following? |
set oldNrepid [lindex $nrepList $repIndex 0] | set oldNrepid [lindex $nrepList $repIndex 0] |
| |
set shown true | set shown true |
| |
#proto_show_nodes_from_list [stride_list 4000 $::skipBadNodeIdList] | #proto_show_nodes_from_list [stride_list 4000 $::skipBadNodeIdList] |
#do cases for styles | #do cases for styles |
set num_neurons [llength $myNodeIdList] | set num_neurons [llength $myNodeIdList] |
set nrepList [lreplace $nrepList $repIndex $repIndex [list $oldNrepid $shown $molec $style $colorMethod $material "global_id == $globalNodeIdList" $stride $num_neurons $displayed_virtuals_at_creation $scaling $resolution]] | set nrepList [lreplace $nrepList $repIndex $repIndex [list $oldNrepid $shown $molec $style $colorMethod $material "gid == $myNodeIdList" $stride $num_neurons $displayed_virtuals_at_creation $scaling $resolution]] |
| |
switch $style { | switch $style { |
soma {proto_show_nodes_from_list_soma_only $myNodeIdList $colorMethod $scaling $resolution} | soma {proto_show_nodes_from_list_soma_only $myNodeIdList $colorMethod $scaling $resolution} |