From 434ebc7d179e84ec5f3ee6cad8c20d5904e05155 Mon Sep 17 00:00:00 2001 From: Don Ward Date: Sun, 10 Mar 2024 10:04:32 +0000 Subject: [PATCH 1/7] Convert tabs to spaces (uni/3d). --- uni/3d/animationcontroller.icn | 46 +++--- uni/3d/animationset.icn | 16 +- uni/3d/basicobject3d.icn | 96 ++++++------ uni/3d/bone.icn | 222 ++++++++++++++-------------- uni/3d/camera.icn | 24 +-- uni/3d/material.icn | 42 +++--- uni/3d/matrix.icn | 98 ++++++------- uni/3d/mesh.icn | 224 ++++++++++++++-------------- uni/3d/modelobject3d.icn | 108 +++++++------- uni/3d/node.icn | 22 +-- uni/3d/quaternion.icn | 52 +++---- uni/3d/selection3D.icn | 146 +++++++++---------- uni/3d/skeleton.icn | 98 ++++++------- uni/3d/skinnedmodelobject3d.icn | 139 +++++++++--------- uni/3d/terrain.icn | 122 ++++++++-------- uni/3d/vector.icn | 88 +++++------ uni/3d/viewer/u3dviewer.icn | 146 +++++++++---------- uni/3d/viewer/world.icn | 116 +++++++-------- uni/3d/xparse.icn | 250 ++++++++++++++++---------------- 19 files changed, 1027 insertions(+), 1028 deletions(-) diff --git a/uni/3d/animationcontroller.icn b/uni/3d/animationcontroller.icn index 93d0e920b..b790a9618 100644 --- a/uni/3d/animationcontroller.icn +++ b/uni/3d/animationcontroller.icn @@ -22,37 +22,37 @@ class AnimationController( #animation_track := [] animation_step := 1 end - + method set_skeleton(skl) skeleton := skl end - + method init_timer() a_clock:=0 end method set_timer(t) - a_clock := t + a_clock := t end - + method get_timer() return a_clock end - + method faster() animation_step +:= 1 DEBUGW("animation_step:", animation_step) return animation_step end - + method slower() if animation_step > 1 then{ - animation_step -:= 1 - DEBUGW("animation_step:", animation_step) - } + animation_step -:= 1 + DEBUGW("animation_step:", animation_step) + } return animation_step end - + # Do we need trk ? method set_animation_track(anim_set, trk) local bone, anim @@ -60,9 +60,9 @@ class AnimationController( #animation_step := anim_set.maxKey/120 a_clock := 0 DEBUGW("anim track set to:", anim_set.label) - + DEBUGW("mapping... animation to bones") - + every anim := ! anim_set.lsAnimation do{ bone := skeleton.get_bone_by_label(anim.boneName) bone.animation := anim @@ -70,29 +70,29 @@ class AnimationController( } DEBUGW("done!") end - + method calc_animation(curious) if /animation_track then fail if a_clock > animation_track.get_max_key() then{ - a_clock := 0 - #CalcAnimation(Skeletton) + a_clock := 0 + #CalcAnimation(Skeletton) } DEBUGW("controller clock:", a_clock) skeleton.calc_animation(a_clock, curious) a_clock +:= animation_step - + end - + method update_animation() a_clock +:= animation_step if a_clock > animation_track.get_max_key() then{ - a_clock := 0 - #CalcAnimation(_Skeletton) - #CalcAttitude(_Skeletton,0) - #SkinMesh(_Skeletton) + a_clock := 0 + #CalcAnimation(_Skeletton) + #CalcAttitude(_Skeletton,0) + #SkinMesh(_Skeletton) } - end - + end + initially init() end diff --git a/uni/3d/animationset.icn b/uni/3d/animationset.icn index 336630ec1..eb8c01a25 100644 --- a/uni/3d/animationset.icn +++ b/uni/3d/animationset.icn @@ -23,24 +23,24 @@ class AnimationSet( method get_label() return label end - + method is_name(nam) if label==name then return self end - - method addAnimation(anim) + + method addAnimation(anim) lsAnimation[anim.boneName]:=anim end - - method get_animation_for_bone(bname) - if member(lsAnimation, bname) then return lsAnimation[bname] + + method get_animation_for_bone(bname) + if member(lsAnimation, bname) then return lsAnimation[bname] end - + method get_max_key() return maxKey end - + initially init() end diff --git a/uni/3d/basicobject3d.icn b/uni/3d/basicobject3d.icn index 33481b8fe..5ada2a0ef 100644 --- a/uni/3d/basicobject3d.icn +++ b/uni/3d/basicobject3d.icn @@ -15,46 +15,46 @@ class BasicObject3D( label, # string loc, # Vector3 orientation_angles, # Vector3 , Orientation in the 3D space - # which are the angles around x, y, z axises + # which are the angles around x, y, z axises scalexyz, - color, + color, radius, # aproximation of the bounding sphere radius - - reference, # Vector3 a refrence point in the 3D space - - bb_max, # max vector and min vector four bounding box calcs - bb_min, # - - visible_section, # Unicon WSection Record - Txyz, # Unicon Translation Record - Rx, # + + reference, # Vector3 a refrence point in the 3D space + + bb_max, # max vector and min vector four bounding box calcs + bb_min, # + + visible_section, # Unicon WSection Record + Txyz, # Unicon Translation Record + Rx, # Ry, # Unicon Rotation Records - Rz, # - + Rz, # + Sxyz, - - - - render_func # rendering function if supplied + + + + render_func # rendering function if supplied ) # render Template for all 3D objects - method render() + method render() visible_section := WSection( label ) - PushMatrix() + PushMatrix() Txyz:=Translate (loc.x, loc.y, loc.z) Sxyz:=Scale(scalexyz.x, scalexyz.y, scalexyz.z) Rx:=Rotate(orientation_angles.x, 1.0, 0.0, 0.0) Ry:=Rotate(orientation_angles.y, 0.0, 1.0, 0.0) Rz:=Rotate(orientation_angles.z, 0.0, 0.0, 1.0) - + render_details() # this is the real render - + PopMatrix() WSection() end - + # every object will override this method to customize # its look in the way it likes method render_details() @@ -65,7 +65,7 @@ class BasicObject3D( method set_render_func(new_render) render_func := new_render end - + method refreshLoc() if /Txyz then fail Txyz.x:=loc.x @@ -79,14 +79,14 @@ class BasicObject3D( Sxyz.y:=scalexyz.y Sxyz.z:=scalexyz.z end - + method refreshRot() if /Rx then fail Rx.angle := orientation_angles.x Ry.angle := orientation_angles.y Rz.angle := orientation_angles.z end - + method set_location (v) loc.set (v) refreshLoc() @@ -94,9 +94,9 @@ class BasicObject3D( method set_locationxyz (x, y, z) loc.setxyz (x, y, z) - refreshLoc() + refreshLoc() end - + # # param count: 1(vector) OR 3(reals) # @@ -104,15 +104,15 @@ class BasicObject3D( if numeric(dx) then loc.addxyz(dx, dy, dz) else - loc.add(dx) + loc.add(dx) refreshLoc() end - + method set_orientation(v) orientation_angles.set(v) refreshRot() end - + method set_orientationxyz(x, y, z) orientation_angles.setxyz(x, y, z) refreshRot() @@ -125,7 +125,7 @@ class BasicObject3D( method set_referencexyz(x, y, z) reference.setxyz(x, y, z) end - + method rotate(rx, ry, rz) if numeric(rx) then orientation_angles.addxyz(rx, ry, rz) @@ -137,49 +137,49 @@ class BasicObject3D( method show() visible_section.skip:=0 end - + method hide() visible_section.skip:=1 end - + method is_hidden() return visible_section.skip=1 end - + method calc_bounding_box() end - method is_colliding( another_object ) - if loc.distance_to( another_object.loc ) < + method is_colliding( another_object ) + if loc.distance_to( another_object.loc ) < radius + another_object.radius then return end - + method set_size_to(val) local d, dx, dy, dz, mesh, tx, ty, tz - + calc_bounding_box() - + /val := 1.0 - + dx := bb_max.x - bb_min.x dy := bb_max.y - bb_min.y dz := bb_max.z - bb_min.z - + tx := -dx / 2.0 - bb_min.x ty := -bb_min.y tz := -dz / 2.0 - bb_min.z - + if dx>dy & dx>dz then - d:=dx + d:=dx else if dy>dz then - d:=dy + d:=dy else - d:=dz + d:=dz - scalexyz.x := scalexyz.y := scalexyz.z := real(val) / d + scalexyz.x := scalexyz.y := scalexyz.z := real(val) / d refreshScale() - + end initially(myname ) @@ -190,4 +190,4 @@ class BasicObject3D( radius := 1.0 bb_min := Vector3(-1,-1,-1) bb_max := Vector3( 1, 1, 1) -end \ No newline at end of file +end diff --git a/uni/3d/bone.icn b/uni/3d/bone.icn index 0ea3b9cce..6ebff727c 100644 --- a/uni/3d/bone.icn +++ b/uni/3d/bone.icn @@ -13,22 +13,22 @@ $include "graphics3dh.icn" # # class Bone : Node( - mesh_name, # the mesh label that this bone works on - mapped_mesh, # the mesh object that this bone works on - tmp_mesh, - local_mesh, # mesh created by using vertex index data in this bone only - - lst_vertex_index, # vertecies affected by this bone + mesh_name, # the mesh label that this bone works on + mapped_mesh, # the mesh object that this bone works on + tmp_mesh, + local_mesh, # mesh created by using vertex index data in this bone only + + lst_vertex_index, # vertecies affected by this bone lst_weight, - + local_matrix, default_local_matrix, - combined_matrix, # =local_matrix * parent_node-combined_matrix - final_matrix, # =skinOfset * combined_matrix - skin_offset_matrix, # Transformation matrix - + combined_matrix, # =local_matrix * parent_node-combined_matrix + final_matrix, # =skinOfset * combined_matrix + skin_offset_matrix, # Transformation matrix + animation, - + display_list_matrix, anim_index_mat,anim_index_R, @@ -38,16 +38,16 @@ class Bone : Node( method init() lst_vertex_index := [] lst_weight := [] - skin_offset_matrix := [] - anim_index_mat:=1 + skin_offset_matrix := [] + anim_index_mat:=1 anim_index_R:=1 anim_index_S:=1 anim_index_T:=1 - + end - - + + # # # @@ -58,17 +58,17 @@ class Bone : Node( local_mesh:=Mesh() local_mesh.label:= mesh_name || "$" || label DEBUGW(" creating new bone mesh ", local_mesh.label ) - + local_mesh.lst_vertex:= mapped_mesh.lst_vertex - local_mesh.lst_vertex_final := local_mesh.lst_vertex + local_mesh.lst_vertex_final := local_mesh.lst_vertex #local_mesh.lst_vertex_index := mapped_mesh.lst_vertex_index local_mesh.lst_texturecoords := mapped_mesh.lst_texturecoords local_mesh.lst_material := mapped_mesh.lst_material local_mesh.lst_face := [] - + i:=1 #n := - + while i <= *(tmp_mesh.lst_face) do{ face := tmp_mesh.lst_face[i] every bonevi := !lst_vertex_index do{ @@ -84,22 +84,22 @@ class Bone : Node( i:=i+1 } } #if - + every node := !subnodes do node.create_local_mesh() - - + + end - + method render_standalone() - + end - - + + method render_final() - + end - + method update_display_list_matrix() local c, i \display_list_matrix | fail @@ -109,34 +109,34 @@ class Bone : Node( # display_list_matrix[i+2] := local_matrix[i] display_list_matrix[3] := local_matrix.A end - - + + method render_in_displaylist() local node - + PushMatrix() display_list_matrix := MultMatrix(local_matrix.to_list()) - + #every writes(!display_list_matrix) - - if \local_mesh then{ - PushMatrix() - MultMatrix(skin_offset_matrix.to_list()) - DEBUGW(" rendering bone mesh ", local_mesh.label ) - local_mesh.render() - PopMatrix() + + if \local_mesh then{ + PushMatrix() + MultMatrix(skin_offset_matrix.to_list()) + DEBUGW(" rendering bone mesh ", local_mesh.label ) + local_mesh.render() + PopMatrix() } - + every node:=!subnodes do node.render_in_displaylist() - + PopMatrix() end - + # Combined_Matrix = Local_Matrix * Combined_Matrix_parent # Final_Matrix = Skin_Offset * Combined_Matrix - method build_final_matrix() + method build_final_matrix() DEBUGW(" Combined Matrix : ", label) if \parent_node then{ combined_matrix := local_matrix.mul2(parent_node.combined_matrix ) @@ -149,26 +149,26 @@ class Bone : Node( final_matrix := skin_offset_matrix.mul2(combined_matrix) else final_matrix := deepcopy (combined_matrix) - + update_display_list_matrix() - + end - + method transform_skin() local i, j, v DEBUGW(" trying to transform skin.... for mesh:", mapped_mesh.label) DEBUGW("image(mapped_mesh.is_rigid)=",image(mapped_mesh.is_rigid)) - + #mapped_mesh.is_rigid :=1 if \(mapped_mesh.is_rigid) then{ - DEBUGW(" Transformaing sking.... for mesh:", mapped_mesh.label) + DEBUGW(" Transformaing sking.... for mesh:", mapped_mesh.label) every i:= 1 to *lst_vertex_index do{ j:=lst_vertex_index[i] #v := mapped_mesh.lst_vertex[j] - v := mapped_mesh.lst_vertex[j].mul_matrix(final_matrix) - mapped_mesh.lst_vertex_final[j].x +:= v.x * lst_weight[i] - mapped_mesh.lst_vertex_final[j].y +:= v.y * lst_weight[i] - mapped_mesh.lst_vertex_final[j].z +:= v.z * lst_weight[i] + v := mapped_mesh.lst_vertex[j].mul_matrix(final_matrix) + mapped_mesh.lst_vertex_final[j].x +:= v.x * lst_weight[i] + mapped_mesh.lst_vertex_final[j].y +:= v.y * lst_weight[i] + mapped_mesh.lst_vertex_final[j].z +:= v.z * lst_weight[i] } } else @@ -185,30 +185,30 @@ class Bone : Node( node.build_skin(mode) end - + method set_local_matrix(lm) local_matrix := lm update_display_list_matrix() end - + method mulLocalMatrix(m) local_matrix := matrixMul (local_matrix, m ) update_display_list_matrix() end - + method rotate(r, axis) local c c:=matrixRotate(r, axis) local_matrix := matrixMul (local_matrix, c ) update_display_list_matrix() end - + method translate(t) end - + method scale(s) end - + method calc_animation(pkey) local delta_key, cur_time, A, B, C, mat, quat, scal, tran, bone @@ -221,79 +221,79 @@ class Bone : Node( mat := Matrix4x4() #If the transformations are expressed as matrices if not(animation.matrix_empty()) then{ - if pkey = 0 then anim_index_mat := 1 - if anim_index_mat >= animation.matrix_size() then - #If we are at the last matrix index use the last matrix as a transform matrix - mat := (animation.get_matrix( -1)).matrix - else{ - # Advance the internal matrix animation index according to the main the_time count - while (pkey > (animation.get_matrix(anim_index_mat+1)).the_time) do { - anim_index_mat+:=1 - if anim_index_mat >= animation.matrix_size() then{ - anim_index_mat := animation.matrix_size()-1 - break - } + if pkey = 0 then anim_index_mat := 1 + if anim_index_mat >= animation.matrix_size() then + #If we are at the last matrix index use the last matrix as a transform matrix + mat := (animation.get_matrix( -1)).matrix + else{ + # Advance the internal matrix animation index according to the main the_time count + while (pkey > (animation.get_matrix(anim_index_mat+1)).the_time) do { + anim_index_mat+:=1 + if anim_index_mat >= animation.matrix_size() then{ + anim_index_mat := animation.matrix_size()-1 + break + } } # while #interpolate the transform matrix between this matrix index and - #the next using the the_time count parameter + #the next using the the_time count parameter #write("mat_index:",anim_index_mat) #write(*(animation.lst_matrix)) - + A := animation.get_matrix(anim_index_mat) B := animation.get_matrix(anim_index_mat+1) C := B.matrix.minus(A.matrix) - delta_key := B.the_time - A.the_time - cur_time := pkey - A.the_time - C.mul_s(real(cur_time) / delta_key) + delta_key := B.the_time - A.the_time + cur_time := pkey - A.the_time + C.mul_s(real(cur_time) / delta_key) mat := A.matrix.plus(C) } local_matrix := mat } else - { + { # Quat := Quaternion() # Scal := ?? # Tran := ?? local_matrix.identity() if (pkey = 0) then{ - anim_index_R := 1 + anim_index_R := 1 anim_index_S := 1 anim_index_T := 1 } #If there are rotations if not(animation.rotation_empty()) then{ - if anim_index_R >= animation.rotation_size() then - #If we are at the last rotation index use the last rotation - quat := (animation.get_rotation(-1)).quat - else{ - #Advance the internal rotation animation index according to the main the_time count - while (pkey > (animation.get_rotation(anim_index_R+1)).the_time) do{ - anim_index_R+:=1 - if anim_index_R >= animation.rotation_size() then{ - anim_index_R := animation.rotation_size() - 1 - break - } - }# while + if anim_index_R >= animation.rotation_size() then + #If we are at the last rotation index use the last rotation + quat := (animation.get_rotation(-1)).quat + else{ + #Advance the internal rotation animation index according to the main the_time count + while (pkey > (animation.get_rotation(anim_index_R+1)).the_time) do{ + anim_index_R+:=1 + if anim_index_R >= animation.rotation_size() then{ + anim_index_R := animation.rotation_size() - 1 + break + } + }# while #Interpolate the quaternion #write("R_index:",anim_index_R) #write(*(animation.lst_rotation)) - + A := animation.get_rotation(anim_index_R) - B := animation.get_rotation(anim_index_R+1) + B := animation.get_rotation(anim_index_R+1) delta_key := B.the_time - A.the_time cur_time := pkey - A.the_time quat := Quaternion() quat.slerp( A.quat, B.quat , real(cur_time)/delta_key) } - + mat.identity() quat.to_matrix(mat) - DEBUGW("BONE LABEL:", label , " -- " , image(mat) ) #, " -- ", image(mat.A)) + DEBUGW("BONE LABEL:", label , " -- " , image(mat) ) #, " -- ", image(mat.A)) local_matrix.mul(mat) } @@ -314,22 +314,22 @@ class Bone : Node( #Interpolate the vector #write("S_index:",anim_index_S) #write(*(animation.lst_scaling)) - + A := animation.get_scaling(anim_index_S) - B := animation.get_scaling(anim_index_S+1) - C := B.v.minus(A.v) + B := animation.get_scaling(anim_index_S+1) + C := B.v.minus(A.v) delta_key := B.the_time - A.the_time cur_time := pkey - A.the_time; - + C.mul( real(cur_time) / delta_key) scal := A.v.plus(C) } mat.identity() mat.scaling_matrix(scal) - local_matrix.mul(mat) - } + local_matrix.mul(mat) + } #if there are translations if not(animation.translation_empty()) then{ @@ -348,25 +348,25 @@ class Bone : Node( #interpolate the vector #write("T_index:",anim_index_T) #write(*(animation.lst_translation)) - + A := animation.get_translation(anim_index_T) - B := animation.get_translation(anim_index_T+1) - C := B.v.minus(A.v) + B := animation.get_translation(anim_index_T+1) + C := B.v.minus(A.v) delta_key := B.the_time - A.the_time cur_time := pkey - A.the_time; - + C.mul( real(cur_time) / delta_key) tran := A.v.plus(C) } mat.identity() mat.translation_matrix(tran) - local_matrix.mul(mat) - } - } - - every bone := !subnodes do - bone.calc_animation(pkey) + local_matrix.mul(mat) + } + } + + every bone := !subnodes do + bone.calc_animation(pkey) end method resetMatrixAll() diff --git a/uni/3d/camera.icn b/uni/3d/camera.icn index f0edf616f..5556234c9 100644 --- a/uni/3d/camera.icn +++ b/uni/3d/camera.icn @@ -23,7 +23,7 @@ class Camera( vRadians, halfPI, - + line, line2 ) @@ -38,18 +38,18 @@ class Camera( # angles that it is rotated in the x-z plane and in the y direction # (horizontal and vertical). - hRadians := 0.0 + hRadians := 0.0 vRadians := 0.0 - + halfPI := &pi/2.0 #Fg("red") #line:=DrawSphere(target.x, target.y, target.z, 0.1) - + #Fg("blue") #line2:=DrawSphere(position.x, position.y, position.z, 0.5) - + #DrawLine( position.x, position.y, position.z, - # target.x, target.y, target.z ) + # target.x, target.y, target.z ) end # # Setting the Camera consists of giving its position and angles that it is @@ -58,7 +58,7 @@ class Camera( method set( x, y, z, h, v) position.setxyz(x, y, z) target := Vector3(0.0, 0.0, 0.0) - upVector := Vector3(0.0, 1.0, 0.0) + upVector := Vector3(0.0, 1.0, 0.0) hRadians := h vRadians := v @@ -66,7 +66,7 @@ class Camera( end # -# Rotating the Camera is possible in both the horizontal and vertical +# Rotating the Camera is possible in both the horizontal and vertical # method rotate( h, v) hRadians +:= h @@ -79,21 +79,21 @@ class Camera( upVector.x := position.x - target.x upVector.y := abs(position.y + radius * sin(vRadians + halfPI)) upVector.z := position.z - target.z - - + + #line[3]:=position.x #line[4]:=position.y #line[5]:=position.z #line.x:=target.x #line.y:=target.y #line.z:=target.z - + Eye(position.x, position.y, position.z, target.x, target.y, target.z, upVector.x, upVector.y, upVector.z) end - + # # Sliding along the vertical and horizontal planes, # diff --git a/uni/3d/material.icn b/uni/3d/material.icn index dde553606..66d85f2ee 100644 --- a/uni/3d/material.icn +++ b/uni/3d/material.icn @@ -27,51 +27,51 @@ class Material( specular:= [1.0 , 1.0 , 1.0] # RGB emissive:= [0.0 , 0.0 , 0.0] # RGB power := 50 - + textureFileName := &null # null if not available - textureRecord := &null + textureRecord := &null end method has_texture_filename() return \textureFileName end - method get_texture_filename() + method get_texture_filename() return \textureFileName end - + method apply() local diff, spec, emis, shin, rec, f, t diff := "diffuse " || string( diffuse[1] * 65535 ) || "," || - string( diffuse[2] * 65535 ) || "," || - string( diffuse[3] * 65535 ) + string( diffuse[2] * 65535 ) || "," || + string( diffuse[3] * 65535 ) #DEBUGW(diff) emis := "emission " || string( emissive[1] * 65535 ) || "," || - string( emissive[2]* 65535 ) || "," || - string( emissive[3]* 65535 ) + string( emissive[2]* 65535 ) || "," || + string( emissive[3]* 65535 ) #DEBUGW(emis) spec := "specular " || string( specular[1] * 65535 ) || "," || - string( specular[2]* 65535 ) || "," || - string( specular[3]* 65535 ) + string( specular[2]* 65535 ) || "," || + string( specular[3]* 65535 ) #DEBUGW(spec) shin := "shininess " || string(power) - + # DEBUGW( shin ) - - + + f:=Fg( diff || ";" || emis || ";" || spec || ";" ||shin ) #Fg( diffuse ); Fg( emissive ); Fg( specular ); Fg( shininess ) - - if has_texture_filename() then{ - if WAttrib("texmode")=="off" then WAttrib("texmode=on") - t:=Texture(get_texture_filename()) - DEBUGW( "Texture :", get_texture_filename() ) - return \t - } + + if has_texture_filename() then{ + if WAttrib("texmode")=="off" then WAttrib("texmode=on") + t:=Texture(get_texture_filename()) + DEBUGW( "Texture :", get_texture_filename() ) + return \t + } return \f end - + initially init() end diff --git a/uni/3d/matrix.icn b/uni/3d/matrix.icn index 475e1a410..c3bcebbea 100644 --- a/uni/3d/matrix.icn +++ b/uni/3d/matrix.icn @@ -19,31 +19,31 @@ class Matrix4x4( every i:=1 to 16 do A[i] := L[i] end - + method to_list() return [ A[1 ], A[2 ], A[3 ], A[4 ], - A[5 ], A[6 ], A[7 ], A[8 ], - A[9 ], A[10], A[11], A[12], - A[13], A[14], A[15], A[16] - ] + A[5 ], A[6 ], A[7 ], A[8 ], + A[9 ], A[10], A[11], A[12], + A[13], A[14], A[15], A[16] + ] end - + method copy_elements_to(L) local i every i:=1 to 16 do L[i] := A[i] end - + method get_copy() local mat, B, i mat := Matrix4x4() B := mat.A every i:=1 to 16 do - B[i] := A[i] - + B[i] := A[i] + return mat end - + method identity() A[1 ] := 1.0; A[2 ] := 0.0; A[3 ] := 0.0; A[4 ] := 0.0 A[5 ] := 0.0; A[6 ] := 1.0; A[7 ] := 0.0; A[8 ] := 0.0 @@ -57,7 +57,7 @@ class Matrix4x4( A[10] :=: A[7] A[13] :=: A[4] A[14] :=: A[8] - A[15] :=: A[12] + A[15] :=: A[12] return self end @@ -66,7 +66,7 @@ class Matrix4x4( every writes(left(string(A[b to (b+4)]),5), " ") write() end - + method print() print_row(1) print_row(2) @@ -187,64 +187,64 @@ class Matrix4x4( method mul(matb) local b, e1:=A[1], e2:=A[2], e3:=A[3], e4:=A[4], e5:=A[5], e6:=A[6], e7:=A[7], - e8:=A[8], e9:=A[9], e10:=A[10], e11:=A[11], e12:=A[12], e13:=A[13], - e14:=A[14], e15:=A[15], e16:=A[16] - + e8:=A[8], e9:=A[9], e10:=A[10], e11:=A[11], e12:=A[12], e13:=A[13], + e14:=A[14], e15:=A[15], e16:=A[16] + b := matb.A - + A[1 ] := e1*b[1] + e2*b[5] + e3*b[9 ] + e4*b[13] A[2 ] := e1*b[2] + e2*b[6] + e3*b[10] + e4*b[14] A[3 ] := e1*b[3] + e2*b[7] + e3*b[11] + e4*b[15] A[4 ] := e1*b[4] + e2*b[8] + e3*b[12] + e4*b[16] - + A[5 ] := e5*b[1] + e6*b[5] + e7*b[9 ] + e8*b[13] A[6 ] := e5*b[2] + e6*b[6] + e7*b[10] + e8*b[14] A[7 ] := e5*b[3] + e6*b[7] + e7*b[11] + e8*b[15] A[8 ] := e5*b[4] + e6*b[8] + e7*b[12] + e8*b[16] - + A[9 ] := e9*b[1] + e10*b[5] + e11*b[9 ] + e12*b[13] A[10] := e9*b[2] + e10*b[6] + e11*b[10] + e12*b[14] A[11] := e9*b[3] + e10*b[7] + e11*b[11] + e12*b[15] A[12] := e9*b[4] + e10*b[8] + e11*b[12] + e12*b[16] - + A[13] := e13*b[1] + e14*b[5] + e15*b[9 ] + e16*b[13] A[14] := e13*b[2] + e14*b[6] + e15*b[10] + e16*b[14] A[15] := e13*b[3] + e14*b[7] + e15*b[11] + e16*b[15] A[16] := e13*b[4] + e14*b[8] + e15*b[12] + e16*b[16] - + return self end method mul2(matb) local matc, b, c, e1:=A[1], e2:=A[2], e3:=A[3], e4:=A[4], e5:=A[5], e6:=A[6], e7:=A[7], - e8:=A[8], e9:=A[9], e10:=A[10], e11:=A[11], e12:=A[12], e13:=A[13], - e14:=A[14], e15:=A[15], e16:=A[16] - + e8:=A[8], e9:=A[9], e10:=A[10], e11:=A[11], e12:=A[12], e13:=A[13], + e14:=A[14], e15:=A[15], e16:=A[16] + matc := Matrix4x4() c := matc.A b := matb.A - + c[1 ] := e1*b[1] + e2*b[5] + e3*b[9 ] + e4*b[13] c[2 ] := e1*b[2] + e2*b[6] + e3*b[10] + e4*b[14] c[3 ] := e1*b[3] + e2*b[7] + e3*b[11] + e4*b[15] c[4 ] := e1*b[4] + e2*b[8] + e3*b[12] + e4*b[16] - + c[5 ] := e5*b[1] + e6*b[5] + e7*b[9 ] + e8*b[13] c[6 ] := e5*b[2] + e6*b[6] + e7*b[10] + e8*b[14] c[7 ] := e5*b[3] + e6*b[7] + e7*b[11] + e8*b[15] c[8 ] := e5*b[4] + e6*b[8] + e7*b[12] + e8*b[16] - + c[9 ] := e9*b[1] + e10*b[5] + e11*b[9 ] + e12*b[13] c[10] := e9*b[2] + e10*b[6] + e11*b[10] + e12*b[14] c[11] := e9*b[3] + e10*b[7] + e11*b[11] + e12*b[15] c[12] := e9*b[4] + e10*b[8] + e11*b[12] + e12*b[16] - + c[13] := e13*b[1] + e14*b[5] + e15*b[9 ] + e16*b[13] c[14] := e13*b[2] + e14*b[6] + e15*b[10] + e16*b[14] c[15] := e13*b[3] + e14*b[7] + e15*b[11] + e16*b[15] c[16] := e13*b[4] + e14*b[8] + e15*b[12] + e16*b[16] - + return matc end @@ -252,29 +252,29 @@ class Matrix4x4( local sint, cost, L sint := sin(angle) cost := cos(angle) - + case axis of{ - "x" :{ - A[ 6] := cost - A[ 7] := sint - A[10] :=-sint - A[11] := cost - } - "y" :{ - A[ 1] := sint - A[ 3] := cost - A[ 9] := cost - A[11] :=-sint - } - "z" :{ - A[ 1] := cost - A[ 2] := sint - A[ 5] :=-sint - A[ 6] := cost - } + "x" :{ + A[ 6] := cost + A[ 7] := sint + A[10] :=-sint + A[11] := cost + } + "y" :{ + A[ 1] := sint + A[ 3] := cost + A[ 9] := cost + A[11] :=-sint + } + "z" :{ + A[ 1] := cost + A[ 2] := sint + A[ 5] :=-sint + A[ 6] := cost + } } # case end - + method scaling_matrix(s) A[ 1] := s.x A[ 6] := s.y @@ -290,4 +290,4 @@ class Matrix4x4( initially(L) A := array(16, 0.0) if \L then set(L) -end \ No newline at end of file +end diff --git a/uni/3d/mesh.icn b/uni/3d/mesh.icn index 740b8f128..b5ac568de 100644 --- a/uni/3d/mesh.icn +++ b/uni/3d/mesh.icn @@ -21,7 +21,7 @@ class Mesh : BasicObject3D ( #lsTexture, lst_material, # list of materilas lst_face, # list of faces - + is_rigid, render_items, render_items_tmp, @@ -59,7 +59,7 @@ class Mesh : BasicObject3D ( method material_count() return *lst_material end - + method texmaterial_count() local m, c:=0 every m:=!lst_material do @@ -81,18 +81,18 @@ class Mesh : BasicObject3D ( method normal_render () local face, L, Ltex, Lnorm, currentMaterial, cm , oldMaterial:=-1, faceMaterial, uv, meshmod, i:=1, j, LL, normod, render_item - - #normod := WAttrib("normode"); + + #normod := WAttrib("normode"); meshmod := WAttrib("meshmode") WAttrib("meshmode=triangles") - + /lst_vertex_final:=lst_vertex - + DEBUGW(" *vertex : ", *lst_vertex) DEBUGW(" *vertex Final : ", *lst_vertex_final) - DEBUGW(" *Faces : ", *lst_face) + DEBUGW(" *Faces : ", *lst_face) DEBUGW(" *texture : ", *lst_texturecoords) - + PushMatrix() render_list_face_count := [] @@ -100,47 +100,47 @@ class Mesh : BasicObject3D ( render_items_tmp:=[] i:=1 while i <= *lst_face do{ - L := []; Ltex := []; Lnorm := [] - currentMaterial := faceMaterial := ( lst_face[i].get_material_id() | 1 ) - - while i<= *lst_face & currentMaterial= faceMaterial do{ - face := lst_face[i] - every put(L, - lst_vertex_final[ !face.lst_vertex_index ]["x" | "y" | "z"]) - every put(Ltex, - lst_texturecoords[ !face.lst_vertex_index ]["u" | "v"]) - /lst_normal | every + L := []; Ltex := []; Lnorm := [] + currentMaterial := faceMaterial := ( lst_face[i].get_material_id() | 1 ) + + while i<= *lst_face & currentMaterial= faceMaterial do{ + face := lst_face[i] + every put(L, + lst_vertex_final[ !face.lst_vertex_index ]["x" | "y" | "z"]) + every put(Ltex, + lst_texturecoords[ !face.lst_vertex_index ]["u" | "v"]) + /lst_normal | every put(Lnorm, lst_normal[ !face.lst_normal_index ]["x"|"y"|"z"]) - faceMaterial := face.get_material_id() - i +:= 1 - } - - put(render_list_face_count, *L) - - if *Ltex * 3/2 ~= *L then write("PROBLEM in texture coords") - - if *lst_material > 0 & oldMaterial~=currentMaterial then{ - cm := lst_material[currentMaterial] - oldMaterial := currentMaterial - if not (cm.apply()) then - WAttrib("texmode")=="off" | WAttrib("texmode=off") - } - - + faceMaterial := face.get_material_id() + i +:= 1 + } + + put(render_list_face_count, *L) + + if *Ltex * 3/2 ~= *L then write("PROBLEM in texture coords") + + if *lst_material > 0 & oldMaterial~=currentMaterial then{ + cm := lst_material[currentMaterial] + oldMaterial := currentMaterial + if not (cm.apply()) then + WAttrib("texmode")=="off" | WAttrib("texmode=off") + } + + $ifdef ARRAYS - *Ltex = 0 | Texcoord(Ltex) - render_item := FillPolygon(L) - #(*Lnorm = 0 & WAttrib("normode=auto") ) | ( WAttrib("normode=on") & Normals(Lnorm)) + *Ltex = 0 | Texcoord(Ltex) + render_item := FillPolygon(L) + #(*Lnorm = 0 & WAttrib("normode=auto") ) | ( WAttrib("normode=on") & Normals(Lnorm)) $else - *Ltex = 0 | Texcoord ! Ltex + *Ltex = 0 | Texcoord ! Ltex - render_item := FillPolygon ! L - #(*Lnorm = 0 & WAttrib("normode=auto") ) | ( WAttrib("normode=on") & Normals(Lnorm)) + render_item := FillPolygon ! L + #(*Lnorm = 0 & WAttrib("normode=auto") ) | ( WAttrib("normode=on") & Normals(Lnorm)) $endif - put(render_items, render_item) - put(render_items_tmp, array(*L, 0.0)) - } # while + put(render_items, render_item) + put(render_items_tmp, array(*L, 0.0)) + } # while WAttrib("texmode")=="off" | WAttrib("texmode=off") WAttrib("meshmode="||string(meshmod)) @@ -148,83 +148,83 @@ $endif PopMatrix() end - + # # update the mesh directly in the display list. No new render items is added to the list # method update_render(curious) local i, face, L, currentMaterial, oldMaterial, faceMaterial, uv, - index, display_item, k, v, n - + index, display_item, k, v, n + oldMaterial := -1 index := 0 i:=1 while i <= *lst_face do{ - - if faceMaterial := lst_face[i].get_material_id() then - currentMaterial := faceMaterial - else - currentMaterial := faceMaterial := 1 - index +:= 1 + if faceMaterial := lst_face[i].get_material_id() then + currentMaterial := faceMaterial + else + currentMaterial := faceMaterial := 1 + + index +:= 1 if /curious then{ if type(render_items[index][3])=="list" then{ - k:=1 - L := render_items[index][3] - } + k:=1 + L := render_items[index][3] + } else{ - k:=3 - L := render_items[index] - } + k:=3 + L := render_items[index] + } } else{ - k:=1 - L := render_items_tmp[index] + k:=1 + L := render_items_tmp[index] } - n:=render_list_face_count[index] - while k 0 & oldMaterial~=currentMaterial then - oldMaterial := currentMaterial + n:=render_list_face_count[index] + while k 0 & oldMaterial~=currentMaterial then + oldMaterial := currentMaterial if \curious then{ curious.notify() curious.wait_key() - } + } - } # while + } # while end - + method swap_anim_keys(curious) local i every i:=1 to *render_items_tmp do render_items_tmp[i] :=: render_items[i][3] end - - + + method render_details() # returns a unicon display list index DEBUGW ( " rendering Mesh...... vx=", image(*lst_vertex), " faces=", image(*lst_face)) @@ -238,7 +238,7 @@ $endif method addMaterial(newMaterial) put(lst_material, newMaterial) end - + method set_label (s) if \s then return (label := s) end @@ -254,26 +254,26 @@ $endif every v := !lst_vertex do { if minv.x > v.x then minv.x := v.x - else + else if maxv.x < v.x then maxv.x := v.x if minv.y > v.y then minv.y := v.y - else + else if maxv.y < v.y then maxv.y := v.y if minv.z > v.z then minv.z := v.z - else + else if maxv.z < v.z then maxv.z := v.z } bb_min := minv bb_max := maxv - + #write(image(bb_min)) #write(image(bb_max)) end @@ -289,39 +289,39 @@ $endif method flip_texcoord() local uv - every uv := !lst_texturecoords do - uv.v := 1.0 - uv.v + every uv := !lst_texturecoords do + uv.v := 1.0 - uv.v end - + method rotate_vx(angle, axis) local anglePI, sin_t, cos_t, v, x, y, z - + anglePI := angle * &pi / 180.0 sin_t := sin(angle) cos_t := cos(angle) - + case axis of{ "z"|"Z" :{ every v := !lst_vertex do{ x := v.x y := v.y - v.x := cos_t * x + sin_t * y - v.y := cos_t * y - sin_t * x + v.x := cos_t * x + sin_t * y + v.y := cos_t * y - sin_t * x } } "y"|"Y" :{ every v := !lst_vertex do{ x := v.x z := v.z - v.x := cos_t * x - sin_t * z - v.z := cos_t * x + sin_t * z + v.x := cos_t * x - sin_t * z + v.z := cos_t * x + sin_t * z } } "x"|"X" :{ every v := !lst_vertex do{ z := v.z y := v.y - v.y := cos_t * y + sin_t * z + v.y := cos_t * y + sin_t * z v.z := cos_t * z - cos_t * y } } @@ -332,9 +332,9 @@ $endif method scale_vx(s) local v every v := !lst_vertex do{ - v.x := v.x * s + v.x := v.x * s v.y := v.y * s - v.z := v.z * s + v.z := v.z * s } end @@ -386,9 +386,9 @@ class Frame( WSection() return render_index_list end - + method activate() - local i, j, main_display_list + local i, j, main_display_list main_display_list := WindowContents() j:=1 every i:=!render_index_list do{ @@ -408,11 +408,11 @@ class Frame( method hide() section.skip:=1 end - + method show() section.skip:=0 end initially - lsMesh := list() + lsMesh := list() end # Class Frame diff --git a/uni/3d/modelobject3d.icn b/uni/3d/modelobject3d.icn index 59f66d99b..7d912c3b3 100644 --- a/uni/3d/modelobject3d.icn +++ b/uni/3d/modelobject3d.icn @@ -11,7 +11,7 @@ $include "graphics3dh.icn" ##################################### # -# load3DModel() should be the IO interface between uModel +# load3DModel() should be the IO interface between uModel # and different 3d model file formats # ##################################### @@ -41,40 +41,40 @@ end class ModelObject3D:BasicObject3D( - model_file_name, # file label of the model - format, # "x", "s3d", or "?" - rendering_mode, # "mesh", "bone", bone_mesh , "morph", or what else? - - lst_mesh, # list of all meshes in the model #concatMesh, - - + model_file_name, # file label of the model + format, # "x", "s3d", or "?" + rendering_mode, # "mesh", "bone", bone_mesh , "morph", or what else? + + lst_mesh, # list of all meshes in the model #concatMesh, + + scale_value ) method init(fname) scale_value := 1 - format := "unkown" + format := "unkown" lst_mesh := [] - - + + if \fname then load(fname) - + end - - + + method load( fname ) local tmp_cs - + if load3DModel(fname, self) then{ - DEBUGW(fname, " model file was loaded successfully!!") + DEBUGW(fname, " model file was loaded successfully!!") model_file_name := fname return } end - + method mesh_count() return *lst_mesh end @@ -102,7 +102,7 @@ class ModelObject3D:BasicObject3D( every c+:=(!lst_mesh).face_count() return c end - + method material_count() local c:=0 every c+:=(!lst_mesh).material_count() @@ -125,7 +125,7 @@ class ModelObject3D:BasicObject3D( method texture_files_count() return *texture_files() end - + method meshes() every suspend !lst_mesh end @@ -137,61 +137,61 @@ class ModelObject3D:BasicObject3D( method flip_texcoord() every (!lst_mesh).flip_texcoord() end - + method render_details() local mesh DEBUGW(" \nRendering model............... ", label ) - + every mesh := !lst_mesh do{ DEBUGW("rendering mesh ", mesh.label) mesh.render() - } + } end - + method translateBy(tx, ty, tz) every (!lst_mesh).translate_vx(tx, ty, tz) end - + method rotateBy(angle, axis) every (!lst_mesh).rotate_vx(angle, axis) end - + method scaleBy(s) every (!lst_mesh).scale_vx(s) end method normalize(factor) local d, dx, dy, dz, mesh, tx, ty, tz - + calc_bounding_box() - + /factor := 1.0 - + dx := bb_max.x - bb_min.x dy := bb_max.y - bb_min.y dz := bb_max.z - bb_min.z - + tx := -dx / 2.0 - bb_min.x ty := -bb_min.y tz := -dz / 2.0 - bb_min.z - + if dx>dy & dx>dz then - d:=dx + d:=dx else if dy>dz then - d:=dy + d:=dy else - d:=dz + d:=dz scale_value := real(factor) / d translateBy(tx, ty, tz) - + every mesh:= !lst_mesh do mesh.scale_vx(scale_value) - - - + + + end @@ -199,16 +199,16 @@ class ModelObject3D:BasicObject3D( # note : this scale adjustment is uniform on all axieses. method adjustScale(adjust_value, adjust_axis, angle, axis) local d, dx, dy, dz, tx, ty, tz - + calc_bounding_box() - + /adjust_value := 1.0 /adjust_axis := "y" - + dy := bb_max.y - bb_min.y dx := bb_max.x - bb_min.x dz := bb_max.z - bb_min.z - + tx := -dx / 2.0 - bb_min.x ty := -dy / 2.0 - bb_min.y tz := -dz / 2.0 - bb_min.z @@ -226,25 +226,25 @@ class ModelObject3D:BasicObject3D( scale_value := real(adjust_value) / d translateBy(tx, ty, tz) - + if \angle then rotateBy(angle, axis) - + scaleBy(scale_value ) - #write("Max x, y ,z :", bb_max.x, ", ", - # bb_max.y, ", ", + #write("Max x, y ,z :", bb_max.x, ", ", + # bb_max.y, ", ", # bb_max.z) - - #write("Min x, y ,z :", bb_min.x, ", ", - # bb_min.y, ", ", + + #write("Min x, y ,z :", bb_min.x, ", ", + # bb_min.y, ", ", # bb_min.z) - + end method calc_bounding_box() - local i, mesh - + local i, mesh + mesh := lst_mesh[1] mesh.calc_bounding_box() bb_min := mesh.bb_min @@ -266,10 +266,10 @@ class ModelObject3D:BasicObject3D( end initially(myname) - + self.BasicObject3D.initially(myname) format := "?" lst_mesh := list() - + end - + diff --git a/uni/3d/node.icn b/uni/3d/node.icn index 5ea55f748..9fcf91ed9 100644 --- a/uni/3d/node.icn +++ b/uni/3d/node.icn @@ -12,21 +12,21 @@ $include "graphics3dh.icn" # This class represents a node in a tree structure. # class Node( - subnodes, # list of subnodes. Tree structure + subnodes, # list of subnodes. Tree structure label, depth, parent_node ) - + method init() parent_node := &null subnodes := [] end - + method set_label (s) if \s then return (label := s) end - + # # return the count of all nodes below the current node. # current node is excluded. @@ -34,10 +34,10 @@ class Node( local n, node n := *subnodes every node := !subnodes do - n +:= node.subtree_count() + n +:= node.subtree_count() return n end - + method add_subnode(node) node.parent_node := self put(subnodes, node) @@ -46,7 +46,7 @@ class Node( method has_subnodes() if *subnodes > 0 then return *subnodes end - + # # Return the {Node} that has the label look4name, or fail # @@ -63,7 +63,7 @@ class Node( method is_leaf() if *subnodes=0 then return end - + # # Generate all the {Nodes} in this subtree, including this {Node}, # in preorder ordering. @@ -86,7 +86,7 @@ class Node( method get_label() return self.label end - + # # Get the parent_node node, or fail if there is none. # @@ -120,8 +120,8 @@ class Node( } } end - + initially() parent_node := &null subnodes := [] -end \ No newline at end of file +end diff --git a/uni/3d/quaternion.icn b/uni/3d/quaternion.icn index cc428cc95..cb0a9465c 100644 --- a/uni/3d/quaternion.icn +++ b/uni/3d/quaternion.icn @@ -6,8 +6,8 @@ # #**************************************************************************** -# * Quaternion code -# +# * Quaternion code +# package graphics3d @@ -35,7 +35,7 @@ method mul(b) local w, x, y, z W := W*b.W - (X*b.X + Y*b.Y + Z*b.Z) - + X := W*b.X + b.W*X + Y*b.Z - Z*b.Y Y := W*b.Y + b.W*Y + Z*b.X - X*b.Z Z := W*b.Z + b.W*Z + X*b.Y - Y*b.X @@ -46,7 +46,7 @@ method times(b) local w, x, y, z w := W*b.W - (X*b.X + Y*b.Y + Z*b.Z) - + x := W*b.X + b.W*X + Y*b.Z - Z*b.Y y := W*b.Y + b.W*Y + Z*b.X - X*b.Z z := W*b.Z + b.W*Z + X*b.Y - Y*b.X @@ -63,7 +63,7 @@ end method invert() local norme, recip - + norme := sqrt(W*W + X*X + Y*Y + Z*Z) if (norme < EPSLN) then norme := 1.0 @@ -97,9 +97,9 @@ end method from_axis(angle, x, y, z) local omega, s, c - + s := sqrt(x*x + y*y + z*z) - + if (s > EPSLN) then{ c := 1.0/s x *:= c @@ -116,7 +116,7 @@ method from_axis(angle, x, y, z) X := Y := Z := 0.0 W := 1.0 } - + normalize() return self end @@ -126,17 +126,17 @@ method to_matrix(matrix) # return a list of 16 real values /matrix := Matrix4x4() matrix.set ( - [ + [ 1.0 - 2.0*Y*Y - 2.0*Z*Z, 2.0*X*Y - 2.0*W*Z, 2.0*X*Z + 2.0*W*Y, - 0.0, + 0.0, 2.0*X*Y + 2.0*W*Z, - 1.0 - 2.0*X*X - 2.0*Z*Z, + 1.0 - 2.0*X*X - 2.0*Z*Z, 2.0*Y*Z - 2.0*W*X, 0.0, 2.0*X*Z - 2.0*W*Y, - 2.0*Y*Z + 2.0*W*X, + 2.0*Y*Z + 2.0*W*X, 1.0 - 2.0*X*X - 2.0*Y*Y, 0.0, 0.0, @@ -155,7 +155,7 @@ method to_matrixOLD(matrix) # return a list of 16 real values matrix[5] := 2.0*X*Y + 2.0*W*Z; matrix[9] := 2.0*X*Z - 2.0*W*Y; matrix[13] := 0.0 - + matrix[2] := 2.0*X*Y - 2.0*W*Z; matrix[6] := 1.0 - 2.0*X*X - 2.0*Z*Z; matrix[10] := 2.0*Y*Z + 2.0*W*X; @@ -165,13 +165,13 @@ method to_matrixOLD(matrix) # return a list of 16 real values matrix[7] := 2.0*Y*Z - 2.0*W*X; matrix[11] := 1.0 - 2.0*X*X - 2.0*Y*Y; matrix[15] := 0.0 - + matrix[4] := 0.0 matrix[8] := 0.0 matrix[12] := 0.0 matrix[16] := 1.0 - - + + return matrix end @@ -182,15 +182,15 @@ method slerp(a, b, t) if ((1.0+cosom) > EPSLN) then{ if ((1.0-cosom) > EPSLN) then{ - omega := acos(cosom) - sinom := sin(omega) - sclp := sin((1.0-t)*omega) / sinom - sclq := sin(t*omega) / sinom - } + omega := acos(cosom) + sinom := sin(omega) + sclp := sin((1.0-t)*omega) / sinom + sclq := sin(t*omega) / sinom + } else{ - sclp := 1.0 - t - sclq := t - } + sclp := 1.0 - t + sclq := t + } X := sclp*a.X + sclq*b.X Y := sclp*a.Y + sclq*b.Y @@ -215,7 +215,7 @@ end method expp() local m, len - + len := sqrt(X*X + Y*Y + Z*Z) if (len > EPSLN) then @@ -227,7 +227,7 @@ method expp() X *:= m Y *:= m - Z *:= m + Z *:= m return self end diff --git a/uni/3d/selection3D.icn b/uni/3d/selection3D.icn index 20fe004bc..c8f8abdc4 100644 --- a/uni/3d/selection3D.icn +++ b/uni/3d/selection3D.icn @@ -11,88 +11,88 @@ class Listener3D(item, obj, action, event_type) return event_type = ev end initially - + end class Selection3D( Tleft_click, Tright_click, Tdouble_click, Tleft_drag, - Tright_drag, counter, - CLICK, LEFT_CLICK, RIGHT_CLICK, DOUBLE_CLICK, - DRAG, LEFT_DRAG, RIGHT_DRAG ) + Tright_drag, counter, + CLICK, LEFT_CLICK, RIGHT_CLICK, DOUBLE_CLICK, + DRAG, LEFT_DRAG, RIGHT_DRAG ) method handle_event(ev) local Tselectable, picked_objects := [], t, x, l static last_click_time, pick_drag initial last_click_time := 0 - + case ev of{ - &lpress:{ - t:=&time - if t-last_click_time > 35 then - Tselectable := Tleft_click - else - Tselectable := Tdouble_click - - last_click_time := t - } - &rpress:{ Tselectable := Tright_click } - &lrelease:{ - pick_drag:=&null - fail - } - &ldrag:{ - if \(l := Tleft_drag[pick_drag] ) then{ - l.action(l.obj) - return - } - fail - } - default : {fail} - } # case - + &lpress:{ + t:=&time + if t-last_click_time > 35 then + Tselectable := Tleft_click + else + Tselectable := Tdouble_click + + last_click_time := t + } + &rpress:{ Tselectable := Tright_click } + &lrelease:{ + pick_drag:=&null + fail + } + &ldrag:{ + if \(l := Tleft_drag[pick_drag] ) then{ + l.action(l.obj) + return + } + fail + } + default : {fail} + } # case + if (not &pick) | /&pick then fail - + #every write(&pick) #write("-------------- new pick", image(&pick)) &pick ? { - while t := tab(find("-") | 0) do{ - push(picked_objects, t) - move(1) - #write("picked:", t) - if pos(0) then break - } # while - } # &pick - + while t := tab(find("-") | 0) do{ + push(picked_objects, t) + move(1) + #write("picked:", t) + if pos(0) then break + } # while + } # &pick + every x := !picked_objects do{ - #x := pop(picked_objects) - #write("work:", image(x)) - pick_drag := x - if \(l := Tselectable[x] ) then{ - l.action(l.obj) - return - } - } # every + #x := pop(picked_objects) + #write("work:", image(x)) + pick_drag := x + if \(l := Tselectable[x] ) then{ + l.action(l.obj) + return + } + } # every end method inc_counter() counter +:= 1 return counter end - + method selectable(item, action, event_type ,obj) - local l, p, selection_id + local l, p, selection_id /event_type := LEFT_CLICK selection_id := item ||"_3D_"|| string(inc_counter()) #write(new_name) - + if \obj then - p := lang::find_method(obj, action) | stop("No such method ", action) + p := lang::find_method(obj, action) | stop("No such method ", action) else - image(action) ? { - ="procedure" | stop("No such procedure ", action) - p := action - } - + image(action) ? { + ="procedure" | stop("No such procedure ", action) + p := action + } + l:= Listener3D(item, obj, p) l.listen_to(event_type) add_listener3D(selection_id, l) @@ -103,14 +103,14 @@ class Selection3D( Tleft_click, Tright_click, Tdouble_click, Tleft_drag, method add_action(selection_id, action, event_type ,obj) local l, p, item /event_type := LEFT_CLICK - + if \obj then - p := lang::find_method(obj, action) | stop("No such method ", action) + p := lang::find_method(obj, action) | stop("No such method ", action) else - image(action) ? { - ="procedure" | stop("No such procedure ", action) - p := action - } + image(action) ? { + ="procedure" | stop("No such procedure ", action) + p := action + } selection_id ? {item := tab(find("_3D_")|0)} l:= Listener3D(item, obj, p) l.listen_to(event_type) @@ -122,20 +122,20 @@ class Selection3D( Tleft_click, Tright_click, Tdouble_click, Tleft_drag, method add_listener3D(selection_id, l) case l.event_type of{ - LEFT_CLICK : {Tleft_click[selection_id] := l} - RIGHT_CLICK : {Tright_click[selection_id] := l} - DOUBLE_CLICK : {Tdouble_click[selection_id] := l} - CLICK : {Tright_click[selection_id] := Tleft_click[selection_id] := l} - DRAG : {Tright_drag[selection_id] := Tleft_drag[selection_id] := l} - LEFT_DRAG : {Tleft_drag[selection_id] := l} - RIGHT_DRAG : {Tright_drag[selection_id] := l} - } + LEFT_CLICK : {Tleft_click[selection_id] := l} + RIGHT_CLICK : {Tright_click[selection_id] := l} + DOUBLE_CLICK : {Tdouble_click[selection_id] := l} + CLICK : {Tright_click[selection_id] := Tleft_click[selection_id] := l} + DRAG : {Tright_drag[selection_id] := Tleft_drag[selection_id] := l} + LEFT_DRAG : {Tleft_drag[selection_id] := l} + RIGHT_DRAG : {Tright_drag[selection_id] := l} + } end - + #method insert_in(id, ev) - + #end - + #method listen_to_event(id, event_type) # if \(l:=Tselectable[new_name]) then l.listen_to(event_type) #end @@ -148,7 +148,7 @@ class Selection3D( Tleft_click, Tright_click, Tdouble_click, Tleft_drag, Tleft_drag := table() Tright_drag := table() CLICK := 1 - LEFT_CLICK:= 2 + LEFT_CLICK:= 2 RIGHT_CLICK := 3 DOUBLE_CLICK := 4 DRAG:=5 diff --git a/uni/3d/skeleton.icn b/uni/3d/skeleton.icn index 90f83aea4..6a18470d7 100644 --- a/uni/3d/skeleton.icn +++ b/uni/3d/skeleton.icn @@ -12,33 +12,33 @@ $include "graphics3dh.icn" class Skeleton( root_bones, lst_mesh, - bone_table, # mapping between bones names and their objects + bone_table, # mapping between bones names and their objects rendering_mode ) - + method setup(lsmesh) local root_bone lst_mesh := lsmesh - every root_bone := !root_bones do{ - root_bone.build_skin(rendering_mode) - #write("bone table ") - create_bone_table(root_bone) - } - if rendering_mode=="bone_mesh_local" then create_bone_local_Mesh() - DEBUGW("done preparing the x model with skeleton") + every root_bone := !root_bones do{ + root_bone.build_skin(rendering_mode) + #write("bone table ") + create_bone_table(root_bone) + } + if rendering_mode=="bone_mesh_local" then create_bone_local_Mesh() + DEBUGW("done preparing the x model with skeleton") end method add_root_bone(bone) /root_bones:=[] put(root_bones, bone) end - + method get_root_bone() local root_bone every root_bone := !root_bones do suspend root_bone end - + method is_empty() if /root_bones then return end @@ -46,16 +46,16 @@ class Skeleton( method is_not_empty() if \root_bones then return end - + method bone_count() local root_bone, tot:=0 if \root_bones then{ - every root_bone := !root_bones do - tot +:= 1 + root_bone.subtree_count() - return tot - } + every root_bone := !root_bones do + tot +:= 1 + root_bone.subtree_count() + return tot + } else - return 0 + return 0 end # @@ -63,9 +63,9 @@ class Skeleton( # method get_bone_by_label(bname) local bone, root_bone - every root_bone := !root_bones do - if bone := root_bone.get_node_by_label(bname) then - return bone + every root_bone := !root_bones do + if bone := root_bone.get_node_by_label(bname) then + return bone end method create_bone_table(bone) @@ -98,61 +98,61 @@ class Skeleton( if tmp_mesh.label==bone.mesh_name then bone.tmp_mesh := tmp_mesh } - - every root_bone := !root_bones do + + every root_bone := !root_bones do root_bone.create_local_mesh() end - + method render() if rendering_mode=="bone_mesh_final" then - render_bones_standalone() + render_bones_standalone() else - render_bones_in_displaylist() + render_bones_in_displaylist() end - + method render_bones_in_displaylist() local root_bone - every root_bone := !root_bones do - root_bone.render_in_displaylist() + every root_bone := !root_bones do + root_bone.render_in_displaylist() end - + method render_bones_standalone() local root_bone - every root_bone := !root_bones do - root_bone.render_standalone() + every root_bone := !root_bones do + root_bone.render_standalone() end method swap_anim_keys(curious) local mesh every mesh := !lst_mesh do - mesh.swap_anim_keys(curious) + mesh.swap_anim_keys(curious) end - - - method calc_animation(anim_clock, curious) + + + method calc_animation(anim_clock, curious) local mesh, root_bone, t t:=&time - every root_bone := !root_bones do - root_bone.calc_animation(anim_clock) + every root_bone := !root_bones do + root_bone.calc_animation(anim_clock) DEBUGW(" calc bone animation::", &time-t) - + t:=&time - every root_bone := !root_bones do - root_bone.build_skin(rendering_mode) + every root_bone := !root_bones do + root_bone.build_skin(rendering_mode) DEBUGW(" rebuilding skin:", &time-t) - + t:=&time if rendering_mode == "bone_mesh_final" then{ - every mesh := !lst_mesh do{ - DEBUGW("special rendering!!! mesh: ", mesh.label) - mesh.update_render(curious) - DEBUGW(" special render:", &time-t) - } + every mesh := !lst_mesh do{ + DEBUGW("special rendering!!! mesh: ", mesh.label) + mesh.update_render(curious) + DEBUGW(" special render:", &time-t) + } } - end - + end + initially() bone_table := table() - + end diff --git a/uni/3d/skinnedmodelobject3d.icn b/uni/3d/skinnedmodelobject3d.icn index fdbd353c1..092d21b6f 100644 --- a/uni/3d/skinnedmodelobject3d.icn +++ b/uni/3d/skinnedmodelobject3d.icn @@ -13,108 +13,108 @@ $include "graphics3dh.icn" # class SkinnedModelObject3D:ModelObject3D( #concatMesh, - + #skinnedMesh, - skeleton, # Skeleton() - is_rigid, # null if the model does not have bones + skeleton, # Skeleton() + is_rigid, # null if the model does not have bones tbl_animation_sets, - animationc, # AnimationController() + animationc, # AnimationController() current_anim, - rendering_mode, # "mesh", "bone", bone_mesh , "morph", or what else? + rendering_mode, # "mesh", "bone", bone_mesh , "morph", or what else? cv_anim, swap_key, key_is_ready, anim_thread ) - + method load( fname ) local tmp_cs - + if load3DModel(fname, self) then{ - DEBUGW(fname, " model file was loaded successfully!!") + DEBUGW(fname, " model file was loaded successfully!!") model_file_name := fname - setup() + setup() return } - + end method setup() local n DEBUGW("---------------------------------- setup()") if skeleton.is_not_empty() then{ - #rendering_mode:="bone_mesh_local" - DEBUGW("reset skin") - reset_skin() + #rendering_mode:="bone_mesh_local" + DEBUGW("reset skin") + reset_skin() skeleton.setup(lst_mesh, rendering_mode) - n:=skeleton.bone_count() - DEBUGW (" This models has this # of bones : ", n) + n:=skeleton.bone_count() + DEBUGW (" This models has this # of bones : ", n) } else{ - reset_skin() - DEBUGW("done preparing the x model with NOOOOOO skeleton") - + reset_skin() + DEBUGW("done preparing the x model with NOOOOOO skeleton") + } end method reset_skin() local mesh, v - + #write("---------------------------------- reset_skin()") if rendering_mode=="mesh" then{ - #write("================ copy original vertex data" ) + #write("================ copy original vertex data" ) every mesh := !lst_mesh do mesh.lst_vertex_final := mesh.lst_vertex - } + } #else if rendering_mode:= "bone_mesh_final" then - # mesh.lst_vertex_final := deepcopy(mesh.lst_vertex) + # mesh.lst_vertex_final := deepcopy(mesh.lst_vertex) else{ every mesh := !lst_mesh do if \mesh.is_rigid then{ - #DEBUGW("mesh is rigid... creating zero vertexfinal ") + #DEBUGW("mesh is rigid... creating zero vertexfinal ") mesh.lst_vertex_final := [] every v := !(mesh.lst_vertex) do put(mesh.lst_vertex_final, Vector3(0, 0, 0)) } else if \skeleton then{ mesh.lst_vertex_final := [] - #DEBUGW("herereeeeeeeeeeeeeeeeeeeeeee") - } + #DEBUGW("herereeeeeeeeeeeeeeeeeeeeeee") + } else{ #DEBUGW("----------- copy original vertex data" ) - mesh.lst_vertex_final := mesh.lst_vertex - } + mesh.lst_vertex_final := mesh.lst_vertex + } } - - end - + + end + method render_details() local mesh DEBUGW(" \nRendering model............... ", label ) - + #every mesh := !lst_mesh do{ # DEBUGW("rendering mesh ", mesh.label) # mesh.render() - # } + # } case rendering_mode of{ - "bone_mesh_local" : {skeleton.render(rendering_mode)} - #"bone_mesh_final" : {skeleton.render(rendering_mode)} - default : { # "rendering_mode=mesh " - every mesh := !lst_mesh do{ - DEBUGW("rendering mesh ", mesh.label) - mesh.render() - } - } - } + "bone_mesh_local" : {skeleton.render(rendering_mode)} + #"bone_mesh_final" : {skeleton.render(rendering_mode)} + default : { # "rendering_mode=mesh " + every mesh := !lst_mesh do{ + DEBUGW("rendering mesh ", mesh.label) + mesh.render() + } + } + } end method bone_count() return skeleton.bone_count() end - + method animation_count() return *tbl_animation_sets end @@ -122,34 +122,34 @@ class SkinnedModelObject3D:ModelObject3D( method addAnimationSet(aSet) tbl_animation_sets[aSet.label] := aSet end - + method get_animationset(nam) - if member(tbl_animation_sets, nam) then - return tbl_animation_sets[nam] + if member(tbl_animation_sets, nam) then + return tbl_animation_sets[nam] end method get_current_animation() return \current_anim end - + method pick_animation(nam) local anim, a if /nam then anim := ?tbl_animation_sets else anim := get_animationset(nam) if \anim then{ - animationc.set_animation_track(anim) + animationc.set_animation_track(anim) current_anim := anim.label - DEBUGW("picked animation:", anim.label) - DEBUGW("max key:", anim.maxKey) - #every a:=!anim.lsAnimation do{ - # DEBUGW("bone:",a.boneName) - # DEBUGW("*M:",*(a.lst_matrix)) - #DEBUGW("*R:",*(a.lst_rotation)) - #DEBUGW("*S:",*(a.lst_scaling)) - #DEBUGW("*T:",*(a.lst_translation)) - #} - } + DEBUGW("picked animation:", anim.label) + DEBUGW("max key:", anim.maxKey) + #every a:=!anim.lsAnimation do{ + # DEBUGW("bone:",a.boneName) + # DEBUGW("*M:",*(a.lst_matrix)) + #DEBUGW("*R:",*(a.lst_rotation)) + #DEBUGW("*S:",*(a.lst_scaling)) + #DEBUGW("*T:",*(a.lst_translation)) + #} + } else DEBUGW("No such animation!") end @@ -157,7 +157,7 @@ class SkinnedModelObject3D:ModelObject3D( method animations() local a every a:=!tbl_animation_sets do - suspend a.get_label() + suspend a.get_label() end method get_animation_max_key(nam) @@ -165,7 +165,7 @@ class SkinnedModelObject3D:ModelObject3D( a:= get_animationset(nam) | fail return a.get_max_key() end - + method calc_animation() if /anim_thread then{ if rendering_mode == "bone_mesh_final" then{ @@ -177,14 +177,14 @@ class SkinnedModelObject3D:ModelObject3D( if /key_is_ready then{ #if /swap_key then { swap_key := 1; signal(cv_anim)} - } + } else{ swap_anim_keys() key_is_ready := &null swap_key := 1 signal(cv_anim) } - } + } end method swap_anim_keys() @@ -192,7 +192,7 @@ class SkinnedModelObject3D:ModelObject3D( end method wait_key() - critical cv_anim: while /swap_key & \key_is_ready do wait(cv_anim) + critical cv_anim: while /swap_key & \key_is_ready do wait(cv_anim) end method start_anim_thread() @@ -219,19 +219,18 @@ class SkinnedModelObject3D:ModelObject3D( initially(myname, rendmod) self.ModelObject3D.initially(myname) - + if /rendmod then - rendering_mode := "bone_mesh_local" # just render the mesh as is. no bones, frames, etc... + rendering_mode := "bone_mesh_local" # just render the mesh as is. no bones, frames, etc... else - rendering_mode := rendmod - + rendering_mode := rendmod + skeleton := Skeleton() skeleton.rendering_mode := rendering_mode - - tbl_animation_sets := table(&null) + + tbl_animation_sets := table(&null) animationc := AnimationController() animationc.set_skeleton(skeleton) - + is_rigid := &null end - diff --git a/uni/3d/terrain.icn b/uni/3d/terrain.icn index 8180d8bf2..e57c888f8 100644 --- a/uni/3d/terrain.icn +++ b/uni/3d/terrain.icn @@ -14,110 +14,110 @@ class Terrain:BasicObject3D( texture_file, base, rows, cols, length, width, height) - + method generate() local i, j base := list(rows) every i:=1 to rows do base[i]:= list(cols) - + every i:= 1 to rows do - every j:=1 to cols do{ - base[i][j]:= Vector3(real(i)/rows*length, - (?1000)/1000.0 * height, - real(j)/cols*length) - } - + every j:=1 to cols do{ + base[i][j]:= Vector3(real(i)/rows*length, + (?1000)/1000.0 * height, + real(j)/cols*length) + } + end - + method render_details() local i, j, meshmod, L, Ltex meshmod := WAttrib("meshmode") WAttrib("meshmode=triangles") Fg("green") - - + + if \texture_file then{ - WAttrib("texmode=on") - Texture(texture_file) + WAttrib("texmode=on") + Texture(texture_file) } - + #DEBUGW("rendering terrain.....") Fg("green") every i:= 1 to rows-1 by 1 do{ L := list()#(rows*6) Ltex := list() - every j:=1 to cols-1 by 1 do{ - put(L,base[i][j].x, base[i][j].y, base[i][j].z, - base[i][j+1].x, base[i][j+1].y, base[i][j+1].z, - base[i+1][j].x, base[i+1][j].y, base[i+1][j].z, - - base[i+1][j].x, base[i+1][j].y, base[i+1][j].z, - base[i][j+1].x, base[i][j+1].y, base[i][j+1].z, - base[i+1][j+1].x, base[i+1][j+1].y, base[i+1][j+1].z - ) - put(Ltex, real(i)/rows*length, real(j)/cols*length, - real(i)/rows*length, real(j+1)/cols*length, - real(i+1)/rows*length, real(j)/cols*length, - real(i+1)/rows*length, real(j)/cols*length, - real(i)/rows*length, real(j+1)/cols*length, - real(i+1)/rows*length, real(j+1)/cols*length) - - } - Texcoord (Ltex) - FillPolygon ! L - } - + every j:=1 to cols-1 by 1 do{ + put(L,base[i][j].x, base[i][j].y, base[i][j].z, + base[i][j+1].x, base[i][j+1].y, base[i][j+1].z, + base[i+1][j].x, base[i+1][j].y, base[i+1][j].z, + + base[i+1][j].x, base[i+1][j].y, base[i+1][j].z, + base[i][j+1].x, base[i][j+1].y, base[i][j+1].z, + base[i+1][j+1].x, base[i+1][j+1].y, base[i+1][j+1].z + ) + put(Ltex, real(i)/rows*length, real(j)/cols*length, + real(i)/rows*length, real(j+1)/cols*length, + real(i+1)/rows*length, real(j)/cols*length, + real(i+1)/rows*length, real(j)/cols*length, + real(i)/rows*length, real(j+1)/cols*length, + real(i+1)/rows*length, real(j+1)/cols*length) + + } + Texcoord (Ltex) + FillPolygon ! L + } + WAttrib("meshmode="||string(meshmod)) - WAttrib("texmode=off") + WAttrib("texmode=off") #DEBUGW("done with terrain.....") end - + method load(fname) local fin, s, p - + DEBUGW("loading terrain....") fin := open(fname) | ( DEBUGW("can't open ", fname) & fail ) - + if /(p := stat(fin)) then DEBUGW("No stat") & fail - + s := reads(fin, p.size) | ( DEBUGW("empty terrain data file?!") & fail ) - + close(fin) - + parse_terrain(s) DEBUGW("DONE loading terrain....") - - return + + return end - + method parse_terrain(s) local base2, i, j, offset static strmove initial { - strmove := proc("move",1) + strmove := proc("move",1) } - + cols := 256 rows := 128 base := list(rows) every i:=1 to rows do - base[i]:= list(cols) - - + base[i]:= list(cols) + + every i:= 1 to rows do{ - offset := (i-1)*256 - every j:=1 to cols do{ - base[i][j]:= Vector3(real(i)/rows*length, - real(ord(s[offset+j])) * height, - real(j)/cols*length) - } - } - + offset := (i-1)*256 + every j:=1 to cols do{ + base[i][j]:= Vector3(real(i)/rows*length, + real(ord(s[offset+j])) * height, + real(j)/cols*length) + } + } + end - + initially(myname, tex) self.BasicObject3D.initially(myname) texture_file:=tex @@ -126,9 +126,9 @@ class Terrain:BasicObject3D( length:=300.0 width:=300.0 height:=0.25 - + #length:=40.0 #width:=40.0 - #height:=0.25 + #height:=0.25 end diff --git a/uni/3d/vector.icn b/uni/3d/vector.icn index 319a338f1..07388510a 100644 --- a/uni/3d/vector.icn +++ b/uni/3d/vector.icn @@ -23,30 +23,30 @@ u, v ) class Vector4:Vector3 ( - w # not used yet, or maybe rarely + w # not used yet, or maybe rarely ) initially(xx, yy, zz, ww) self.Vector3.initally(xx, yy, zz) if /ww then w:=1.0 else w:=ww -end +end class Vector3 ( x,y,z ) - - method set(v) # set the vector values to vector/list v values + + method set(v) # set the vector values to vector/list v values x := v[1] y := v[2] z := v[3] end - - method setxyz(xx, yy, zz) # set the vector values to vector v values + + method setxyz(xx, yy, zz) # set the vector values to vector v values x := xx y := yy z := zz end - + method add(v) # add vector v to the current vector x +:= v[1] y +:= v[2] @@ -58,13 +58,13 @@ class Vector3 ( y +:= yy z +:= zz end - + method sub(v) # subtract vector v from the current vector x -:= v[1] y -:= v[2] z -:= v[3] end - + method subxyz(xx, yy, zz) x -:= xx y -:= yy @@ -94,7 +94,7 @@ class Vector3 ( y *:= s z *:= s end - + method div(s) x *:= s y *:= s @@ -106,62 +106,62 @@ class Vector3 ( y := -y z := -z end - + method extend (d) # extend the length of the vector by d. (preserve the direction) - local t, len + local t, len len := length() if len=0 then len:=3.0 - t := d/len + t := d/len x +:= x * t y +:= y * t z +:= z * t end - + method equal(v) return x=v.x & y=v.y & z=v.z end - + method is_zero() return 0=x=y=z end - + method LT(v) return xv[1] & y>v[2] & z>v[3] end - + method GTOE(v) return x>=v[1] & y>=[2] & z>=v[3] end - + method get() return Vector3(x, y, z) end - - method length() + + method length() return sqrt(x*x+y*y+z*z) end - + # retunrs the disctance between the vector v and the current vector - method distance_to(v) + method distance_to(v) local a, b, c a :=(x - v.x) b :=(y - v.y) c :=(z - v.z) return sqrt(a*a + b*b + c*c ) end - - method dot(v) + + method dot(v) return ( x*v.x + y*v.y + z*v.z) end - + method cross(v) return Vector3(( y*v.z - z*v.y ), ( z*v.x - x*v.z ), @@ -171,7 +171,7 @@ class Vector3 ( method get_unit() local len len:=length() - if len~=0 then + if len~=0 then return Vector3(x/len, y/len, z/len) end @@ -183,29 +183,29 @@ class Vector3 ( y:=y/len z:=z/len end - + method mul_matrix(m) local xx:=x, yy:=y, zz:=z, newv, A - + A:= m.A - + newv := Vector3() - + newv.x := A[1]*xx + A[5]*yy + A[ 9]*zz + A[13] newv.y := A[2]*xx + A[6]*yy + A[10]*zz + A[14] newv.z := A[3]*xx + A[7]*yy + A[11]*zz + A[15] return newv end - - initially(xx, yy, zz) + + initially(xx, yy, zz) if\xx then{ - x:=xx - y:=yy - z:=zz - } - else{ - x:=0.0 - y:=0.0 - z:=0.0 - } -end \ No newline at end of file + x:=xx + y:=yy + z:=zz + } + else{ + x:=0.0 + y:=0.0 + z:=0.0 + } +end diff --git a/uni/3d/viewer/u3dviewer.icn b/uni/3d/viewer/u3dviewer.icn index 556d83b23..a88db3670 100644 --- a/uni/3d/viewer/u3dviewer.icn +++ b/uni/3d/viewer/u3dviewer.icn @@ -9,7 +9,7 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, menubar, mHelp, tianimation, start_dir, wdir, files_history , tblanimation, tckeys, tcname, check_box_group_animation , tcFrames, mioptions, mipreferences, treeskeleton) - + method component_setup() self.setup() setup_animationbtns() @@ -23,23 +23,23 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, world.w3d := view_model3d.cwin \(world.w3d) | write("Window is null!!") end - + method init_history() local fin, what, dat, line, mif, f, fname, i start_dir := wdir := chdir() | "" files_history := [] fin := open("last_session.ini") | fail - + while line := read(fin) do{ - line ? { - what := tab(find(":")) | next - move(1) - dat := tab(0) | next - case what of{ - "dir" : stat(dat) & wdir := dat - "file": stat(dat) & put(files_history, dat) - } - } # line ? + line ? { + what := tab(find(":")) | next + move(1) + dat := tab(0) | next + case what of{ + "dir" : stat(dat) & wdir := dat + "file": stat(dat) & put(files_history, dat) + } + } # line ? } # while close(fin) @@ -48,40 +48,40 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, mFile.add(MenuSeparator()) every i := 1 to *files_history do { - f := files_history[i] - mif := TextMenuItem() - fname := file_name(f) - mif.set_label(i || ". " ||fname) - mif.connect(self, "on_mif", ACTION_EVENT) - mFile.add(mif) - } + f := files_history[i] + mif := TextMenuItem() + fname := file_name(f) + mif.set_label(i || ". " ||fname) + mif.connect(self, "on_mif", ACTION_EVENT) + mFile.add(mif) + } end - + method add_file_history(f) local i, replace, mif, items, base if f==files_history[1] then fail # the new file is already at the top of the list every i := 2 to *files_history do - if f == files_history[i] then { - delete(files_history, i) - break replace := i - } + if f == files_history[i] then { + delete(files_history, i) + break replace := i + } push(files_history, f) return #if *files_history=1 then mFile.add(MenuSeparator()) - + if /replace then{ - mif := TextMenuItem() - mif.set_label(f) - mif.connect(self, "on_mif", ACTION_EVENT) - mFile.add(mif) - } + mif := TextMenuItem() + mif.set_label(f) + mif.connect(self, "on_mif", ACTION_EVENT) + mFile.add(mif) + } else{ - items := mFile.get_children() - base := *items - *files_history - mif := items[base+replace] - mFile.remove(mif) - mFile.add(mif, base+1) - } + items := mFile.get_children() + base := *items - *files_history + mif := items[base+replace] + mFile.remove(mif) + mFile.add(mif, base+1) + } end method on_mif(ev) @@ -91,7 +91,7 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, \i | fail load_file(files_history[i]) end - + method on_miLoadModel(ev) local fd, fname #$ifdef _UNIX @@ -101,13 +101,13 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, fname := fd.get_result() | fail ##$else # fname := WinOpenDialog("Open 3D Model File...", "", 50) | fail - #$endif + #$endif if not(map(fname[-4:0]) == ".s3d" | map(fname[-2:0]) == ".x" )then fail load_file(fname) end - + method load_file(fname) world.w3d := view_model3d.cwin world.load (fname, 1.8) | fail @@ -118,29 +118,29 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, world.render() self.display() end - + method fill_animation() local anim, LL := [] every anim := world.mod3d.animations() do { - put(LL, [anim, world.mod3d.get_animation_max_key(anim) | "?"]) - } + put(LL, [anim, world.mod3d.get_animation_max_key(anim) | "?"]) + } tblanimation.set_contents(LL) tsstat.display() end - + method fill_summary() local LL := [ - [ "meshes", world.mod3d.mesh_count() ], - [ "vertices", world.mod3d.vertex_count() ], - [ "normals", world.mod3d.normals_count() ], - [ "polygons", world.mod3d.face_count() ], - [ "bones", world.mod3d.bone_count() ], - [ "animations", world.mod3d.animation_count() ], - [ "all materials", world.mod3d.material_count() ], - [ "textured materials", world.mod3d.texmaterial_count() ], - [ "texture files", world.mod3d.texture_files_count() ], - [ "texture coords", world.mod3d.texture_coords_count() ] - ] + [ "meshes", world.mod3d.mesh_count() ], + [ "vertices", world.mod3d.vertex_count() ], + [ "normals", world.mod3d.normals_count() ], + [ "polygons", world.mod3d.face_count() ], + [ "bones", world.mod3d.bone_count() ], + [ "animations", world.mod3d.animation_count() ], + [ "all materials", world.mod3d.material_count() ], + [ "textured materials", world.mod3d.texmaterial_count() ], + [ "texture files", world.mod3d.texture_files_count() ], + [ "texture coords", world.mod3d.texture_coords_count() ] + ] tblsummary.set_contents(LL) tsstat.display() end @@ -149,10 +149,10 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, local fout, f chdir(start_dir) fout := open("last_session.ini", "w") | - stop("can't write last_session.ini") + stop("can't write last_session.ini") write(fout, "dir:",wdir ) every f := !files_history do - write(fout, "file:", f) + write(fout, "file:", f) close(fout) self.dispose() end @@ -164,13 +164,13 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, Notice(" Unicon 3D viewer ", " Version 1.0 ", "", - " Developer : Jafar Al-Gharaibeh ", - " Email : to.jafar@gmail.com ", - " Date : Dec 30, 2010 ") - + " Developer : Jafar Al-Gharaibeh ", + " Email : to.jafar@gmail.com ", + " Date : Dec 30, 2010 ") + &window := win end - + method logit(msgs[]) local msg := "" static L @@ -183,12 +183,12 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, tllogmsg.ensure_row_visible(*L) tllogmsg.display() end - + method on_play() if on_tblanimation() then - world.set_auto_refresh() + world.set_auto_refresh() end - + method on_stop() world.unset_auto_refresh() end @@ -199,19 +199,19 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, method setup_animationbtns() local animation_toolbar, icnbtn, panel_1 - + animation_toolbar := ToolBar() animation_toolbar.set_pos("2", "70%") animation_toolbar.set_size("96%", "41") #animation_toolbar.set_draw_border() - + panel_1 := Panel() panel_1.set_pos("2", "50%") panel_1.set_size("96%", "35") panel_1.set_align("l", "c") - + check_box_group_animation := CheckBoxGroup() - + icnbtn := ToggleIconButton() icnbtn.set_pos("34", "50%") icnbtn.set_align("l", "c") @@ -222,7 +222,7 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, icnbtn.set_img("18,c1,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~33~~~~~~~~~~~~~~~~303~~~~~~~~~~~~~~~3003~~~~~~~~~~~~~~30003~~~~~~~~~~~~~300003~~~~~~~~~~~~3000003~~~~~~~~~~~30000003~~~~~~~~~~30000006~~~~~~~~~~3000006~~~~~~~~~~~300006~~~~~~~~~~~~30006~~~~~~~~~~~~~3006~~~~~~~~~~~~~~306~~~~~~~~~~~~~~~36~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") icnbtn.connect(self, "on_play", ACTION_EVENT) panel_1.add(icnbtn) - + icnbtn := ToggleIconButton() icnbtn.set_pos("68", "50%") icnbtn.set_align("l", "c") @@ -233,7 +233,7 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, icnbtn.set_img("18,c1,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~333333~333333~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~300006~300006~~~~~366666~366666~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") icnbtn.connect(self, "on_pause", ACTION_EVENT) panel_1.add(icnbtn) - + icnbtn := ToggleIconButton() icnbtn.set_pos("102", "50%") icnbtn.set_align("l", "c") @@ -245,10 +245,10 @@ class U3DViewer : Dialog(view_model3d, mFile, miLoadModel, miQuit, icnbtn.connect(self, "on_stop", ACTION_EVENT) panel_1.add(icnbtn) animation_toolbar.add(panel_1) - + tianimation.add(animation_toolbar) - end - + end + method on_tblanimation(ev) local LL, a, row static last_anim diff --git a/uni/3d/viewer/world.icn b/uni/3d/viewer/world.icn index 03391e822..4c8d2b898 100644 --- a/uni/3d/viewer/world.icn +++ b/uni/3d/viewer/world.icn @@ -9,7 +9,7 @@ class World( ) # -# load model fname and set its coordinates to "fit" in size +# load model fname and set its coordinates to "fit" in size # method load(fname, size) if \fname then{ @@ -37,13 +37,13 @@ method render() WAttrib("light1=diffuse white; ambient white; specular white; position 5.0, 5.0, -5.0") WAttrib("light0=on") WAttrib("light1=on") - - + + logger.logit("Rendering...") t:=&time #DrawSphere(0, 0, 0, 0.2) mod3d.render() - logger.logit("Done rendering in " || &time-t || " ms.") + logger.logit("Done rendering in " || &time-t || " ms.") &window :=tmpw end @@ -69,80 +69,80 @@ method handle_event() while *Pending()>0 do{ case Event() of { - "\e" : exit() - "a" : mod3d.move( 0.05, 0, 0) - "A" : mod3d.move(-0.05, 0, 0) - "s" : mod3d.move( 0, 0.05, 0) - "S" : mod3d.move( 0,-0.05, 0) - "d" : mod3d.move( 0, 0, 0.05) - "D" : mod3d.move( 0, 0,-0.05) - - "z" : mod3d.rotate( 2, 0, 0) - "Z" : mod3d.rotate(-2, 0 ,0) - "x" : mod3d.rotate( 0, 2, 0) - "X" : mod3d.rotate( 0,-2, 0) - "c" : mod3d.rotate( 0, 0, 2) - "C" : mod3d.rotate( 0, 0,-2) - - Key_Up :cam.move( d) - Key_Down :cam.move(-d) - - Key_Left :cam.rotate(-0.1, 0) - Key_Right:cam.rotate( 0.1, 0) - - "w" : cam.slide( 0.1, 0) - "W" : cam.slide(-0.1, 0) - "e" : cam.slide( 0, 0.1) - "E" : cam.slide( 0,-0.1) - - "3" : logger.logit("camera step: ", d+:= 0.2) - "4" : logger.logit("camera step: ", d-:= 0.2) - - - "1" : logger.logit("animation step: ", mod3d.animationc.faster() ) - "2" : logger.logit("animation step: ", mod3d.animationc.slower() ) - "0" : (/auto_refresh:=1) | auto_refresh:=&null - - "+" : { - mod3d.calc_animation() - } - " " :{ - mod3d.pick_animation() - #mod3d.calc_animation() - } - "m" :{ - mod3d.pick_animation("Walk") - #mod3d.calc_animation() - } - - Key_PgUp : cam.rotate( 0, 0.1) - Key_PgDn : cam.rotate( 0,-0.1) + "\e" : exit() + "a" : mod3d.move( 0.05, 0, 0) + "A" : mod3d.move(-0.05, 0, 0) + "s" : mod3d.move( 0, 0.05, 0) + "S" : mod3d.move( 0,-0.05, 0) + "d" : mod3d.move( 0, 0, 0.05) + "D" : mod3d.move( 0, 0,-0.05) + + "z" : mod3d.rotate( 2, 0, 0) + "Z" : mod3d.rotate(-2, 0 ,0) + "x" : mod3d.rotate( 0, 2, 0) + "X" : mod3d.rotate( 0,-2, 0) + "c" : mod3d.rotate( 0, 0, 2) + "C" : mod3d.rotate( 0, 0,-2) + + Key_Up :cam.move( d) + Key_Down :cam.move(-d) + + Key_Left :cam.rotate(-0.1, 0) + Key_Right:cam.rotate( 0.1, 0) + + "w" : cam.slide( 0.1, 0) + "W" : cam.slide(-0.1, 0) + "e" : cam.slide( 0, 0.1) + "E" : cam.slide( 0,-0.1) + + "3" : logger.logit("camera step: ", d+:= 0.2) + "4" : logger.logit("camera step: ", d-:= 0.2) + + + "1" : logger.logit("animation step: ", mod3d.animationc.faster() ) + "2" : logger.logit("animation step: ", mod3d.animationc.slower() ) + "0" : (/auto_refresh:=1) | auto_refresh:=&null + + "+" : { + mod3d.calc_animation() + } + " " :{ + mod3d.pick_animation() + #mod3d.calc_animation() + } + "m" :{ + mod3d.pick_animation("Walk") + #mod3d.calc_animation() + } + + Key_PgUp : cam.rotate( 0, 0.1) + Key_PgDn : cam.rotate( 0,-0.1) } #case - + #write(mod3d.Name) if /auto_refresh then Refresh() - + }#while if \auto_refresh then{ #t1 := &time mod3d.calc_animation() t2 := &time - Refresh() + Refresh() t3:=&time fr+:=1 - + if t3-t > 5000 then{ #write("refresh time", t3 - t2) logger.logit( fr / 5.0, " fps") t:=t3 fr:=0 } - + #write("calc time", t2 - t1) - + } end diff --git a/uni/3d/xparse.icn b/uni/3d/xparse.icn index 6d75d9fea..13491b729 100644 --- a/uni/3d/xparse.icn +++ b/uni/3d/xparse.icn @@ -20,43 +20,43 @@ class XFile( has_bones, texture_format, texture_path - + ) method load(fname, m3d) local s, fin, p filename := fname - fin := open(filename) | - ( DEBUGW("can't open "|| filename) & fail ) + fin := open(filename) | + ( DEBUGW("can't open "|| filename) & fail ) s := reads(fin, 16) | - ( DEBUGW("empty x file?!") & close(fin) & fail) + ( DEBUGW("empty x file?!") & close(fin) & fail) checkHeader(s) | fail - p := stat(fin) | - ( DEBUGW("can't stat "|| filename) & close(fin) & fail ) + p := stat(fin) | + ( DEBUGW("can't stat "|| filename) & close(fin) & fail ) + + s := reads(fin, p.size) | + ( DEBUGW("empty x file?!") & close(fin) & fail ) - s := reads(fin, p.size) | - ( DEBUGW("empty x file?!") & close(fin) & fail ) - current_model := m3d current_xfile := self has_bones := &null s ? { Xparse() } - + close(fin) - return + return end method checkHeader(s) s ? { - ="xof " | DEBUGW("Not a .X model file. Aborted...") + ="xof " | DEBUGW("Not a .X model file. Aborted...") integer( move(2) ) <= 3 | DEBUGW("Major version greater than 03. Aborted...") integer( move(2) ) <= 3 | DEBUGW("Minor version greater than 03. Aborted...") - ="txt" | DEBUGW(" Not a text file format. Aborted...") + ="txt" | DEBUGW(" Not a text file format. Aborted...") } return @@ -67,12 +67,12 @@ method set_texture_path(texpath) texture_path := texpath else texture_path := texpath || PS - + stat(texture_path) | DEBUGW(texture_path || " Doesn't exist!") end # if set, map the texture file names read in the model file` to the new format -# Probably this function should be extened to check if the underlying unicon +# Probably this function should be extened to check if the underlying unicon # supports jpg and png method set_texture_format(f) if f == (".gif" | ".png" | ".jpg") then @@ -100,17 +100,17 @@ end # i:= *fpath # while i>0 & fpath[i] ~== (PS) do # i-:=1 -# +# # if i=0 then return fpath # return fpath[i+1:0] # end -# +# # method path_name(fpath) # local i # i:= *fpath # while i>0 & fpath[i] ~== (PS) do # i-:=1 -# +# # if i>0 then return fpath[1:i+1] # end @@ -119,22 +119,22 @@ method Xparse() local root_bone while not(pos(0)) do{ case parseBlock() of { - "Error" : { DEBUGW("Stopped parseing the file ..."); fail} - "Comment" : {} # nothing to do - "}" : {} # end of a block ?! - "Frame" : parseBone(&null) - "Mesh" : parseMesh() - "Material" : parseMaterial(1) # 1? material will be used later - "AnimationSet" : parseAnimationSets() + "Error" : { DEBUGW("Stopped parseing the file ..."); fail} + "Comment" : {} # nothing to do + "}" : {} # end of a block ?! + "Frame" : parseBone(&null) + "Mesh" : parseMesh() + "Material" : parseMaterial(1) # 1? material will be used later + "AnimationSet" : parseAnimationSets() #"template" : - #"{" : + #"{" : default: avoidTemplate() - } + } } if \has_bones then - every root_bone := !current_model.skeleton.root_bones do - MapMeshToBones(root_bone) + every root_bone := !current_model.skeleton.root_bones do + MapMeshToBones(root_bone) return end @@ -147,14 +147,14 @@ method parseBlock() #DEBUGW ("new block") case move(1) of { - "{": { + "{": { move(-1) return "{" } - "}": return "}" # We arrived at the end of the block + "}": return "}" # We arrived at the end of the block "/": { - if move(1)~=="/" then - return "Error" #we parseed a block label starting with slash ?! + if move(1)~=="/" then + return "Error" #we parseed a block label starting with slash ?! else nextline() @@ -167,9 +167,9 @@ method parseBlock() } default:{ move(-1) - Text := parse_identifier() - /Text:="null" - #DEBUGW(" Identifier : ", Text) + Text := parse_identifier() + /Text:="null" + #DEBUGW(" Identifier : ", Text) return BlockID(Text) } } #case @@ -223,17 +223,17 @@ end method parseBone(parentBone) local token, cBoneName, cBone - - cBoneName := parse_identifier() | getID("B") + + cBoneName := parse_identifier() | getID("B") jump_after("{") if /tempBoneTable then cBone := Bone() else{ if member(tempBoneTable, cBoneName) then - cBone := tempBoneTable[cBoneName] + cBone := tempBoneTable[cBoneName] else - cBone := Bone() + cBone := Bone() } cBone.set_label( cBoneName ) @@ -248,24 +248,24 @@ method parseBone(parentBone) parentBone.add_subnode(cBone) DEBUGW(" :sub bone") } - + token := "{" while(token ~== "}") do{ case (token := parseBlock()) of{ - "Comment": {} # used for spaces and other kind of comments - "}" : return # this is the end - "{" : { + "Comment": {} # used for spaces and other kind of comments + "}" : return # this is the end + "{" : { cBone.mesh_name := parse_identifier() jump_after("}") } - "Frame" : parseBone(cBone) + "Frame" : parseBone(cBone) "FrameTransformMatrix": parseFrameTransformMatrix(cBone) "Mesh" : { parseMesh() cBone.mesh_name := current_mesh.label cBone.mapped_mesh := current_mesh } - default : avoidTemplate() + default : avoidTemplate() } } end @@ -274,13 +274,13 @@ end method parseMesh() local mesh, token, nVertices, nFaces mesh := Mesh() - current_mesh := mesh + current_mesh := mesh current_model.addMesh(mesh) mesh.set_label(parse_identifier()|getID("M")) jump_after("{") - DEBUGW(" new mesh was created - Mesh: ", mesh.label) + DEBUGW(" new mesh was created - Mesh: ", mesh.label) - nVertices := parse_int() + nVertices := parse_int() semicolon() nextline() DEBUGW("Number of vertices:", nVertices) @@ -291,17 +291,17 @@ method parseMesh() nextline() DEBUGW("Number of Faces:", nFaces) mesh.lst_face := parseArray(nFaces, parseFace) - + token := "{" while(token ~== "}") do{ case token := parseBlock() of { - "Comment" :{} # used for spaces and other kind of comments - "}" : return # this is the end - "MeshNormals" : parseMeshNormals() - "MeshTextureCoords" : parseMeshTextureCoords() - "MeshMaterialList" : parseMeshMaterials() - "SkinWeights" : parseSkinWeights() - #"XSkinMeshHeader" : + "Comment" :{} # used for spaces and other kind of comments + "}" : return # this is the end + "MeshNormals" : parseMeshNormals() + "MeshTextureCoords" : parseMeshTextureCoords() + "MeshMaterialList" : parseMeshMaterials() + "SkinWeights" : parseSkinWeights() + #"XSkinMeshHeader" : default: avoidTemplate() } } @@ -311,11 +311,11 @@ method parseMeshTextureCoords() local nTextureCoords jump_after("{") - nTextureCoords := parse_int() + nTextureCoords := parse_int() semicolon() nextline() DEBUGW("Number of Texture Coords:", nTextureCoords) - current_mesh.lst_texturecoords := + current_mesh.lst_texturecoords := parseArray(nTextureCoords, parseTextureCoords) jump_after("}") end @@ -324,7 +324,7 @@ method parseMeshMaterials() local id, token, nMaterials, nFace, i, L jump_after("{") - nMaterials := parse_int() + nMaterials := parse_int() semicolon() skip_whitespace() #DEBUGW("Number of Materials :", nMaterials) @@ -347,18 +347,18 @@ method parseMeshMaterials() token := "{" while(token ~== "}") do{ case token := parseBlock() of { - "Comment" : {} - "}" : return - "Material" : parseMaterial() - "{" : { - jump_after("{") - skip_whitespace() - id := parse_identifier() - if \blockTable[id] then current_mesh.addMaterial(blockTable[id]) - jump_after("}") - } + "Comment" : {} + "}" : return + "Material" : parseMaterial() + "{" : { + jump_after("{") + skip_whitespace() + id := parse_identifier() + if \blockTable[id] then current_mesh.addMaterial(blockTable[id]) + jump_after("}") + } default: avoidTemplate() - }#case + }#case }# while end @@ -368,19 +368,19 @@ method parseMeshNormals() nNormals := parse_int() semicolon() nextline() - #DEBUGW("Number of normals:", nNormals) + #DEBUGW("Number of normals:", nNormals) current_mesh.lst_normal := parseArray(nNormals, parseVertex ) nFace := parse_int() semicolon() nextline() L:=parseArray(nFace, parseFaceNormals) # parseArray(nFaces, parseFace) - + if *L=*current_mesh.lst_face then every i:=1 to nFace do - current_mesh.lst_face[i].lst_normal_index := L[i] + current_mesh.lst_face[i].lst_normal_index := L[i] else - DEBUGW("ERROR: The number of face normals is not correct:", *L) + DEBUGW("ERROR: The number of face normals is not correct:", *L) jump_after("}") end @@ -393,31 +393,31 @@ method find_texture(tex_fname) tex_fname := replace_slash(tex_fname) #endif - if \texture_format & map(tex_fname[-4:0]) ~== texture_format then + if \texture_format & map(tex_fname[-4:0]) ~== texture_format then tex_fname := map(tex_fname[1:-4]) || texture_format - + if stat(tex_fname) then return tex_fname - + texfnamebase := file_name(tex_fname) # try the model's dir if xpath:=directory_name(filename) then{ tex_fname2 := xpath || texfnamebase if stat(tex_fname2) then return tex_fname2 } - - # try the current dir. + + # try the current dir. # And better to remember the current dir in case the user changes it xpath := chdir() || PS if stat(xpath || texfnamebase) then return xpath || tex_fname - + # try the textures path set by the user if stat(texture_path || texfnamebase) then return texture_path || texfnamebase - + # couldn't find the texture! DEBUGW(" Error: texture (", tex_fname, ") doesn't exist for 3D model: ", filename) - + end method parseMaterial(to_table) @@ -459,28 +459,28 @@ method parseMaterial(to_table) token := "{" while(token ~== "}") do { case token := parseBlock() of { - "Comment" : {} - "}" :{ + "Comment" : {} + "}" :{ if /to_table then current_mesh.addMaterial(newMaterial) else blockTable[id] := newMaterial return } - "TextureFilename":{ - jump_after("{") + "TextureFilename":{ + jump_after("{") #jump_after("\"") | stop("error in texture file label") tab(upto('"')) move(1) tex_fname := tab(upto('"')) | stop("error in texture file label") - if not (tex_fname := find_texture(tex_fname)) then - DEBUGW(" file not found..!! ", tex_fname) - + if not (tex_fname := find_texture(tex_fname)) then + DEBUGW(" file not found..!! ", tex_fname) + newMaterial.textureFileName := tex_fname jump_after("}") - # probably should get rid of this. not usefull anymore - if newMaterial.textureFileName[1]=="." then + # probably should get rid of this. not usefull anymore + if newMaterial.textureFileName[1]=="." then newMaterial.textureFileName := newMaterial.textureFileName[5:0] } default: avoidTemplate() @@ -498,7 +498,7 @@ end method parseSkinWeights() local cBone, temp, nVertices, L - jump_after("{") + jump_after("{") jump_after("\"") temp := tab(upto('"')) move(1) @@ -550,15 +550,15 @@ method parseAnimationSets() "Comment": {} "}":{ animationSet.maxKey := maxKey - DEBUGW("MaxKey:", maxKey) + DEBUGW("MaxKey:", maxKey) current_model.addAnimationSet( animationSet) return } "Animation": parseAnimations(animationSet) default: avoidTemplate() - }# case + }# case }# while - + animationSet.maxKey := maxKey DEBUGW("MaxKey:", maxKey) current_model.addAnimationSet( animationSet) @@ -566,14 +566,14 @@ end method parseAnimations(animationSet) #Frm::AnimationSet* &pAS); local token, tempAnimation - + tempAnimation := AnimationKeys() jump_after("{") - + token := "{" while(token ~== "}") do{ case token := parseBlock() of{ - "Comment": {} + "Comment": {} "}":{ animationSet.addAnimation(tempAnimation) return @@ -586,7 +586,7 @@ method parseAnimations(animationSet) #Frm::AnimationSet* &pAS); } "AnimationKey": parseAnimationKeys(tempAnimation) default: avoidTemplate() - } # case + } # case } #while animationSet.addAnimation(tempAnimation) end @@ -600,7 +600,7 @@ method parseRotationKey() semicolon() if tempRot.the_time > current_xfile.maxKey then current_xfile.maxKey := tempRot.the_time - # we could do (parse_int() , semicolon) + # we could do (parse_int() , semicolon) # but we don't want this number (we know it is 4 for rotation) so tab(upto(';')+1) @@ -621,17 +621,17 @@ method parseScalingKey() tempScale := ScaleKey() tempScale.v := Vector3() tempScale.the_time := parse_int() - + semicolon() if tempScale.the_time > current_xfile.maxKey then current_xfile.maxKey := tempScale.the_time - # we could do (parse_int() , semicolon) + # we could do (parse_int() , semicolon) # but we don't want this number (we know it is 3 for scaling) so #jump_after(";") - + tab(upto(';')+1) tab(many(' \t\r\n')) - + ( tempScale.v.x := parse_real(), coma() & @@ -646,54 +646,54 @@ end method parseAnimationKeys(animation) #Frm::Animation* &pA); local key_type, Size, Data, tempRot, tempScale, tempPos, tempMatrix - jump_after("{") + jump_after("{") key_type := parse_int() semicolon() nextline() - + Size := parse_int() semicolon() nextline() case key_type of { 0:{ - #DEBUGW(" Rotation Keys:", Size) + #DEBUGW(" Rotation Keys:", Size) animation.lst_rotation := parseArray(Size, graphics3d__XFile_parseRotationKey) #DEBUGW(" Rotations read: ", *animation.lst_rotation) } # 0 1:{ - #DEBUGW("Scaling Keys : ", Size) + #DEBUGW("Scaling Keys : ", Size) animation.lst_scaling := parseArray(Size, graphics3d__XFile_parseScalingKey) #DEBUGW(" Scalings read: ", *animation.lst_scaling) } #1 2:{ - #DEBUGW("Position Keys: ", Size) + #DEBUGW("Position Keys: ", Size) animation.lst_translation := parseArray(Size, graphics3d__XFile_parseScalingKey) #DEBUGW(" positions read: ", *animation.lst_translation) } # 2 4:{ - #DEBUGW(Size, "Matrix Keys") + #DEBUGW(Size, "Matrix Keys") while (Size>0 ) do{ Size -:= 1 tempMatrix := MatrixKey() - tempMatrix.the_time := parse_int() - semicolon() + tempMatrix.the_time := parse_int() + semicolon() if tempMatrix.the_time > maxKey then - maxKey := tempMatrix.the_time + maxKey := tempMatrix.the_time jump_after(";") - + tempMatrix.matrix := Matrix4x4() tempMatrix.matrix.set( parseArray(16, parse_real) ) - + semicolon() - coma() | semicolon() + coma() | semicolon() skip_whitespace() animation.addAnimationKey("matrix", tempMatrix) } } # 4 default: DEBUGW("Unknown Key Type", key_type, " ...") - } + } jump_after("}") @@ -730,10 +730,10 @@ initially() blockTable := table() tempBoneTable := &null X_TemplateID := set( "template" , "FrameTransformMatrix", "Frame", - "XSkinMeshHeader", "MeshTextureCoords", "MeshMaterialList", - "MeshNormals","Mesh", "Material", "SkinWeights", "TextureFilename", - "AnimationSet", "AnimationKey", "Animation", "Header" - ) + "XSkinMeshHeader", "MeshTextureCoords", "MeshMaterialList", + "MeshNormals","Mesh", "Material", "SkinWeights", "TextureFilename", + "AnimationSet", "AnimationKey", "Animation", "Header" + ) end ################################################################################### @@ -763,7 +763,7 @@ end procedure parseVertex() local v v := Vector3() - + ( v.x := parse_real(), semicolon() & v.y := parse_real(), semicolon() & v.z := parse_real(), semicolon() @@ -775,7 +775,7 @@ procedure parseFace() local face face := Face() # we are assuming that each face has exactly 3 vertices! skip next num - ( parse_int(), semicolon() ) # unused num + ( parse_int(), semicolon() ) # unused num ( put( face.lst_vertex_index, parse_int_add_one()), coma() & put( face.lst_vertex_index, parse_int_add_one()), coma() & put( face.lst_vertex_index, parse_int_add_one()), semicolon() @@ -858,7 +858,7 @@ procedure skip_whitespace() # and comments if they are there if /ch then return if ch =="/" then{ tab(find("\n")+1) - tab(many(' \r\n\t')) + tab(many(' \r\n\t')) } else move(-1) From 6a8fe5a2f730cdb664834bb1425c3602e6a713ae Mon Sep 17 00:00:00 2001 From: Don Ward Date: Sun, 10 Mar 2024 11:32:04 +0000 Subject: [PATCH 2/7] Convert tabs to spaces (uni/gui). --- uni/gui/addressgui.icn | 14 +- uni/gui/clipboard.icn | 6 +- uni/gui/component.icn | 166 ++--- uni/gui/componentscrollarea.icn | 12 +- uni/gui/dialog.icn | 94 +-- uni/gui/drawscrollarea.icn | 6 +- uni/gui/editabletextlist.icn | 1092 +++++++++++++++--------------- uni/gui/image.icn | 46 +- uni/gui/menubar.icn | 22 +- uni/gui/messagebox.icn | 6 +- uni/gui/panel.icn | 4 +- uni/gui/printdlg.icn | 24 +- uni/gui/scrollarea.icn | 14 +- uni/gui/selectablescrollarea.icn | 32 +- uni/gui/stddlg.icn | 304 ++++----- uni/gui/textbutton.icn | 14 +- uni/gui/textfield.icn | 28 +- uni/gui/yesnodialog.icn | 4 +- 18 files changed, 944 insertions(+), 944 deletions(-) diff --git a/uni/gui/addressgui.icn b/uni/gui/addressgui.icn index fa17a6f1e..c49038ccc 100644 --- a/uni/gui/addressgui.icn +++ b/uni/gui/addressgui.icn @@ -51,12 +51,12 @@ procedure getLogin() if f := open(getenv("HOME")||"/.abook_key") then { read(f) ? { - user := tab(upto(':')) - move(1) - pw := tab(upto(':')|0) - } - close(f) - } + user := tab(upto(':')) + move(1) + pw := tab(upto(':')|0) + } + close(f) + } else { f := LoginDialog() f.show_modal() @@ -556,7 +556,7 @@ class AddressGui : Dialog(newAddress,helpButton,quitButton,addrListArea,miscText m := MessageBox(helpMesg) m.show_modeless(self) - + end #

diff --git a/uni/gui/clipboard.icn b/uni/gui/clipboard.icn index 4013b3985..5ea65c7b1 100644 --- a/uni/gui/clipboard.icn +++ b/uni/gui/clipboard.icn @@ -20,9 +20,9 @@ class Clipboard(content) method set_content(o) if \o then if \ &window then - WAttrib("selection=" || o) + WAttrib("selection=" || o) else - content := o + content := o #write("set clipboard to " || image(o.get_value())) end @@ -32,7 +32,7 @@ class Clipboard(content) method get_content() if \ &window then return WAttrib("selection") else - return content + return content end end diff --git a/uni/gui/component.icn b/uni/gui/component.icn index 27b44f37a..cd0f3e145 100644 --- a/uni/gui/component.icn +++ b/uni/gui/component.icn @@ -20,22 +20,22 @@ $include "guih.icn" class Component : Object : SetFields : Connectable( # # x position as specified by {set_pos()}, eg "50%" - # + # x_spec, # # y position as specified by set_pos(). # y_spec, # - # width specifier as specified in set_size(), eg "100%" + # width specifier as specified in set_size(), eg "100%" # - w_spec, + w_spec, # # height specifier as specified in set_size(), # - h_spec, + h_spec, # - # x alignment as specified in set_align(), eg "l". + # x alignment as specified in set_align(), eg "l". # x_align, # @@ -50,7 +50,7 @@ class Component : Object : SetFields : Connectable( # # Absolute y position. # - y, # + y, # # # Absolute width in pixels computed from w_spec and the # dimensions of the enclosing object or window. @@ -74,13 +74,13 @@ class Component : Object : SetFields : Connectable( # # Flag indicating whether the {Component} currently is shaded; # {&null} means it isn't. - is_shaded_flag, + is_shaded_flag, # # A cloned window created by combining the Dialog's canvas # with the Component's attributes, so drawing into this window # will draw straight to the Dialog window with the correct # attributes. - cwin, + cwin, # # A cloned window created by combining a buffer window with # the {Component's} attributes. This is used solely for @@ -98,7 +98,7 @@ class Component : Object : SetFields : Connectable( # # Tooltip string # - tooltip, + tooltip, # # Reference to enclosing {Component} object. # @@ -335,24 +335,24 @@ class Component : Object : SetFields : Connectable( } else if e === (&lrelease | &rrelease | &mrelease) then { fire_icon_events_on_mouse(MOUSE_RELEASE_EVENT, e) } else { - # - # Non-mouse events. By definition, these generate an ICON_EVENT. - # If they are key presses, they generate a KEY_PRESS_EVENT. - # If they are key releases, they generate a KEY_RELEASE_EVENT. - # KEY_RELEASE_EVENTs do not occur unless input mask requests - # them, and ivib does not yet know about KEY_RELEASE_EVENTs. - # The other tricky part here is that in order for subcomponents - # to get any events out of this, one has to visit children, which - # is what the fire_..._on_mouse event does, as opposed to fire(). - # - if (type(e)=="string") | (integer(e)>0) then { - fire_icon_events_on_mouse(KEY_PRESS_EVENT, e) - } - else if integer(e) < -14 then { - # -14 is the smallest built-in event, aka LASTEVENTCODE - # need to think about whether this should be defined in guih.icn - fire_icon_events_on_mouse(KEY_RELEASE_EVENT, e) - } + # + # Non-mouse events. By definition, these generate an ICON_EVENT. + # If they are key presses, they generate a KEY_PRESS_EVENT. + # If they are key releases, they generate a KEY_RELEASE_EVENT. + # KEY_RELEASE_EVENTs do not occur unless input mask requests + # them, and ivib does not yet know about KEY_RELEASE_EVENTs. + # The other tricky part here is that in order for subcomponents + # to get any events out of this, one has to visit children, which + # is what the fire_..._on_mouse event does, as opposed to fire(). + # + if (type(e)=="string") | (integer(e)>0) then { + fire_icon_events_on_mouse(KEY_PRESS_EVENT, e) + } + else if integer(e) < -14 then { + # -14 is the smallest built-in event, aka LASTEVENTCODE + # need to think about whether this should be defined in guih.icn + fire_icon_events_on_mouse(KEY_RELEASE_EVENT, e) + } fire(ICON_EVENT, e) } end @@ -380,7 +380,7 @@ class Component : Object : SetFields : Connectable( end # - # Set auto_refresh so that the component + # Set auto_refresh so that the component # resize() itself on add()/remove() # method set_auto_refresh() @@ -424,7 +424,7 @@ class Component : Object : SetFields : Connectable( self.is_shaded_flag := &null self.invalidate() end - + # # Toggle whether or not to draw a border around the component. # Different objects respond differently to this flag being @@ -471,7 +471,7 @@ class Component : Object : SetFields : Connectable( # # This draws, or re-draws, the component and all its children in the dialog # window. - # @param buffer_flag If this parameter is not null, then + # @param buffer_flag If this parameter is not null, then # @ the component is displayed into the buffer window, not # @ the dialog window (this is used for double-buffering purposes). # @@ -576,7 +576,7 @@ class Component : Object : SetFields : Connectable( # # Set the alignment of the component. Options for # {x_align} are ``l'', ``c'' and ``r'', for left, centre, and right - # alignment. Options for {y_align} are ``t'', ``c'' and ``b'', + # alignment. Options for {y_align} are ``t'', ``c'' and ``b'', # for top centre and bottom alignment. The default alignment is ``l'', ``t''. # # @param x_align The x alignment @@ -641,35 +641,35 @@ class Component : Object : SetFields : Connectable( if /self.parent then fatal("incorrect ancestry (parent null)") if /self.cwin | /dont_force_new_win then { - parent_dialog := parent.get_parent_dialog_reference() - if cwin := (Clone ! ([parent.get_cwin_reference()] ||| attribs)) then { - cbwin := (Clone ! ([parent.get_cbwin_reference()] ||| attribs)) - } - else { - # Clone failed, what to do? Try to drop a single - # attribute, as that will identify which one is hurting us. - every i := 1 to *attribs do { - p := pop(attribs) - if cwin := (Clone ! ([parent.get_cwin_reference()] ||| attribs)) then { - write(&errout, "clone failed, had to discard attribute ", image(p)) - break - } - push(attribs, p) - } - if /cwin then { - write(&errout, "clone failed, discarding attributes:") - every write(&errout, "\t", ! attribs) - cwin := Clone(parent.get_cwin_reference()) - if /cwin then fatal("multiple bad attributes") - cbwin := Clone(parent.get_cbwin_reference()) - if /cbwin then fatal("bad cbwin, multiple bad attributes") - } - else { - cbwin := (Clone ! ([parent.get_cbwin_reference()] ||| attribs)) - if /cbwin then fatal("bad cbwin, not sure why") - } - } - } + parent_dialog := parent.get_parent_dialog_reference() + if cwin := (Clone ! ([parent.get_cwin_reference()] ||| attribs)) then { + cbwin := (Clone ! ([parent.get_cbwin_reference()] ||| attribs)) + } + else { + # Clone failed, what to do? Try to drop a single + # attribute, as that will identify which one is hurting us. + every i := 1 to *attribs do { + p := pop(attribs) + if cwin := (Clone ! ([parent.get_cwin_reference()] ||| attribs)) then { + write(&errout, "clone failed, had to discard attribute ", image(p)) + break + } + push(attribs, p) + } + if /cwin then { + write(&errout, "clone failed, discarding attributes:") + every write(&errout, "\t", ! attribs) + cwin := Clone(parent.get_cwin_reference()) + if /cwin then fatal("multiple bad attributes") + cbwin := Clone(parent.get_cbwin_reference()) + if /cbwin then fatal("bad cbwin, multiple bad attributes") + } + else { + cbwin := (Clone ! ([parent.get_cbwin_reference()] ||| attribs)) + if /cbwin then fatal("bad cbwin, not sure why") + } + } + } every (!self.children).init() end @@ -717,13 +717,13 @@ class Component : Object : SetFields : Connectable( # # Parse a position specification into an absolute value. # @param total The total value - # @param s The size specifier + # @param s The size specifier # method parse_pos(total, s) local pct, off s ? { if pct := 0.01 * integer(tab(upto('%'))) then { - move(1) + move(1) if ="-" then off := -integer(tab(0)) | fail else if ="+" then @@ -885,10 +885,10 @@ class Component : Object : SetFields : Connectable( j := *self.children while j>0 do { if self.children[j]===c then fail # we have it. - j-:=1 - } - - if /i | i=0 | i=*self.children then + j-:=1 + } + + if /i | i=0 | i=*self.children then put(self.children, c) else insert(self.children, i, c) @@ -898,7 +898,7 @@ class Component : Object : SetFields : Connectable( if self.is_dialog_open() & \self.auto_refresh then{ c.init(1) self.resize() - } + } return end @@ -911,7 +911,7 @@ class Component : Object : SetFields : Connectable( every i := 1 to *self.children do { if self.children[i] === c then { delete(self.children, i) - if self.is_dialog_open() & \(self.auto_refresh) then + if self.is_dialog_open() & \(self.auto_refresh) then self.resize() return } @@ -1105,27 +1105,27 @@ class Component : Object : SetFields : Connectable( "pointer" : set_pointer(string_val(attr, val)) "allow_drop" : if test_flag(attr, val) then - set_allow_drop() + set_allow_drop() else clear_allow_drop() "allow_drag" : if test_flag(attr, val) then - set_allow_drag() + set_allow_drag() else clear_allow_drag() - "is_shaded" : + "is_shaded" : if test_flag(attr, val) then - set_is_shaded() + set_is_shaded() else clear_is_shaded() - "draw_border" : + "draw_border" : if test_flag(attr, val) then - set_draw_border() + set_draw_border() else clear_draw_border() - "accepts_focus" : + "accepts_focus" : if test_flag(attr, val) then - set_accepts_focus() + set_accepts_focus() else clear_accepts_focus() "pos" : set_pos!string_vals(attr, val) @@ -1145,13 +1145,13 @@ class Component : Object : SetFields : Connectable( static attrib_set initial { attrib_set := set() - every insert(attrib_set, "label" | "posx" | "pos" | "posy" | "resize" | "size" | "height" | - "width" | "lines" | "columns" | "image" | "canvas" | "iconpos" | "iconlabel" | - "iconimage" | "echo" | "cursor" | "x" | "y" | "row" | "col" | "pointer" | - "pointerx" | "pointery" | "pointerrow" | "pointercol" | "display" | "depth" | - "displayheight" | "displaywidth" | "fg" | "bg" | "reverse" | "drawop" | "gamma" | - "font" | "fheight" | "fwidth" | "ascent" | "descent" | "leading" | "linewidth" | - "linestyle" | "fillstyle" | "pattern" | "clipx" | "clipy" | "clipw" | "cliph" | + every insert(attrib_set, "label" | "posx" | "pos" | "posy" | "resize" | "size" | "height" | + "width" | "lines" | "columns" | "image" | "canvas" | "iconpos" | "iconlabel" | + "iconimage" | "echo" | "cursor" | "x" | "y" | "row" | "col" | "pointer" | + "pointerx" | "pointery" | "pointerrow" | "pointercol" | "display" | "depth" | + "displayheight" | "displaywidth" | "fg" | "bg" | "reverse" | "drawop" | "gamma" | + "font" | "fheight" | "fwidth" | "ascent" | "descent" | "leading" | "linewidth" | + "linestyle" | "fillstyle" | "pattern" | "clipx" | "clipy" | "clipw" | "cliph" | "dx" | "dy" | "inputmask") } return member(attrib_set, s) diff --git a/uni/gui/componentscrollarea.icn b/uni/gui/componentscrollarea.icn index 3a873d13e..92264cbd4 100644 --- a/uni/gui/componentscrollarea.icn +++ b/uni/gui/componentscrollarea.icn @@ -11,7 +11,7 @@ link graphics $include "guih.icn" -class ComponentScrollAreaView : Component(inner, +class ComponentScrollAreaView : Component(inner, inner_w, inner_h, temp_win) @@ -58,7 +58,7 @@ class ComponentScrollAreaView : Component(inner, if \self.transparent then{ inner.display(1) return - } + } W := if /buffer_flag then self.cwin else self.cbwin EraseArea(temp_win, x, y, w, h) @@ -75,9 +75,9 @@ class ComponentScrollAreaView : Component(inner, method set_inner(inner) self.inner := inner inner.set_pos(0, 0) - inner_w := integer(inner.w_spec) | + inner_w := integer(inner.w_spec) | fatal("Inner component of ComponentScrollArea must have absolute width") - inner_h := integer(inner.h_spec) | + inner_h := integer(inner.h_spec) | fatal("Inner component of ComponentScrollArea must have absolute height") add(inner) end @@ -103,7 +103,7 @@ class ComponentScrollAreaView : Component(inner, end # -# This class allows an arbitrary Component to be placed within +# This class allows an arbitrary Component to be placed within # the ScrollArea. The component is set with the {set_inner()} # method, and it must have an absolute size, ie not specified # in percentage terms. @@ -119,7 +119,7 @@ class ComponentScrollArea : ScrollArea() end method get_subject_width() - return view.inner_w + return view.inner_w end method get_subject_height() diff --git a/uni/gui/dialog.icn b/uni/gui/dialog.icn index 04c8b31ae..a2b6a8b18 100644 --- a/uni/gui/dialog.icn +++ b/uni/gui/dialog.icn @@ -20,13 +20,13 @@ class Dialog : Component( is_open, # Flag indicates whether window is open owning_dialog, child_dialogs, - focus, # Component with current focus + focus, # Component with current focus unique_flag, # Flag indicates whether in unique processing mode re_process_flag, # Flag indicates whether to distribute last # Icon event during unique mode buffer_win, # Buffer window for double buffering - min_width, # Minimum size of window. - min_height, # + min_width, # Minimum size of window. + min_height, # click_count, # Variables controlling multiple clicks double_click_delay, repeat_delay, # Repeat event delays @@ -46,7 +46,7 @@ class Dialog : Component( invokes, all_valid, tooltip_ticker, - tooltip_last_obj, + tooltip_last_obj, tooltip_state, tooltip_start_time, tooltip_end_time, @@ -59,7 +59,7 @@ class Dialog : Component( tooltip_y, tooltip_w, tooltip_h, - abs_pos_flag # set if set_pos() has been called + abs_pos_flag # set if set_pos() has been called ) method invoke_validate() @@ -163,7 +163,7 @@ class Dialog : Component( end # - # Displays the dialog as a modeless dialog. This + # Displays the dialog as a modeless dialog. This # means that window events are processed by this dialog # and other open dialogs concurrently. The call to # {show_modeless()} opens the dialog and returns immediately. @@ -212,7 +212,7 @@ class Dialog : Component( method resize_win(w, h) WAttrib(self.win, "size=" || w || "," || h) - Enqueue(self.win, &resize) + Enqueue(self.win, &resize) end method init() @@ -315,7 +315,7 @@ class Dialog : Component( # # This empty method may be overridden to add components to the # dialog. Alternatively, components may be added in the dialog's - # {initially} method. + # {initially} method. # method component_setup() @@ -337,11 +337,11 @@ class Dialog : Component( # giving up and aborting the whole program. if (not self.open_win()) & - ((not match("font=",attribs[i:=1 to *\attribs])) | - ((attribs[i] := + ((not match("font=",attribs[i:=1 to *\attribs])) | + ((attribs[i] := "font=-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1") & - (not self.open_win()))) then - fatal("couldn't open/show window") + (not self.open_win()))) then + fatal("couldn't open/show window") self.init() self.is_open := 1 @@ -364,7 +364,7 @@ class Dialog : Component( self.bevel_dispose() self.tooltip_dispose() if \ (is_open) then - self.close_win() + self.close_win() self.is_open := &null dispatcher.del(self) delete((\owning_dialog).child_dialogs, self) @@ -417,7 +417,7 @@ $endif } if /self.unique_flag & /self.re_process_flag then { - if /self.curr_drag then + if /self.curr_drag then check_dnd(e) if \self.curr_drag then @@ -451,15 +451,15 @@ $endif do_handle_event(e) if (e === ("\t" | Key_Right | Key_Down)) & - ( /self.focus | not(self.focus.keeps(e))) then { + ( /self.focus | not(self.focus.keeps(e))) then { if c := find_next_focus() then self.set_focus(c, e) - } + } else if (e === (Shift_Tab | Key_Left | Key_Up)) & - ( /self.focus | not(self.focus.keeps(e))) then { + ( /self.focus | not(self.focus.keeps(e))) then { if c := find_previous_focus() then self.set_focus(c, e) - } + } synch_pointer() end @@ -528,11 +528,11 @@ $endif ww := WAttrib(self.win, "width") wh := WAttrib(self.win, "height") if not (cw := Clone(self.cwin, "bg=pale yellow", "font=sans,14", "fg=black")) then - # try again with default font - if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black")) then - if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black", - "font=-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1")) then - fail + # try again with default font + if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black")) then + if not (cw := Clone(self.cwin, "bg=pale yellow", "fg=black", + "font=-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1")) then + fail fh := WAttrib(cw, "fheight") if find("\n", obj.tooltip) then multiline := 1 @@ -542,17 +542,17 @@ $endif numlines := 1 tooltip_w := 0 obj.tooltip ? { - while line := tab(find("\n")) do { - put(lines, line) - ="\n" - numlines +:= 1 - tooltip_w <:= TextWidth(line) + 4 - } - if line := tab(0) & *line > 0 then { - put(lines, line) - tooltip_w <:= TextWidth(line) + 4 - } - } + while line := tab(find("\n")) do { + put(lines, line) + ="\n" + numlines +:= 1 + tooltip_w <:= TextWidth(line) + 4 + } + if line := tab(0) & *line > 0 then { + put(lines, line) + tooltip_w <:= TextWidth(line) + 4 + } + } tooltip_h := fh*numlines + 6 tooltip_x := x + 8 @@ -564,16 +564,16 @@ $endif tooltip_y := 0 <= wh - tooltip_h tooltip_win := WOpen("canvas=hidden", "size=" || - tooltip_w || "," || tooltip_h) + tooltip_w || "," || tooltip_h) CopyArea(cwin, tooltip_win, tooltip_x, tooltip_y, tooltip_w, tooltip_h, - 0, 0) + 0, 0) EraseRectangle(cw, tooltip_x, tooltip_y, tooltip_w, tooltip_h) Rectangle(cw, tooltip_x, tooltip_y, tooltip_w, tooltip_h) every i := 1 to *lines do { - center_string(cw, tooltip_x + tooltip_w / 2, - tooltip_y + 3 + fh * (i-1) + fh/2, lines[i], obj.accel) - } + center_string(cw, tooltip_x + tooltip_w / 2, + tooltip_y + 3 + fh * (i-1) + fh/2, lines[i], obj.accel) + } Uncouple(cw) end @@ -652,7 +652,7 @@ $endif x1 := WAttrib(self.win, "pointerx") y1 := WAttrib(self.win, "pointery") every c := self.generate_components() do { - if \c.tooltip & c.is_unhidden() & c.in_region(x1, y1) then + if \c.tooltip & c.is_unhidden() & c.in_region(x1, y1) then return c } end @@ -671,7 +671,7 @@ $endif ps := find_pointer_component() - if (ps ~=== self.pointer_component) | + if (ps ~=== self.pointer_component) | ((\ps).pointer ~== WAttrib(self.win, "pointer")) then { if \self.pointer_component then restore_pointer() @@ -738,7 +738,7 @@ $endif (abs(&x - self.drag_gesture_x) > 3 | abs(&y - self.drag_gesture_y) > 3 ) then { # Try to begin a drag. - self.curr_drag := self.invoke_can_drag(e) + self.curr_drag := self.invoke_can_drag(e) self.tried_drag := 1 if \self.curr_drag then { change_pointer("exchange") @@ -749,7 +749,7 @@ $endif end # - # Process a resize + # Process a resize # @p method handle_resize(e) local nw, nh @@ -918,7 +918,7 @@ $endif "repeat_rate" : set_repeat_rate(int_val(attr, val)) "min_size" : set_min_size!int_vals(attr, val) # - # For a dialog, interpret pos and size as Icon attributes, not set_pos + # For a dialog, interpret pos and size as Icon attributes, not set_pos # and set_size method invocations. # "pos" | "size" : set_attribs(as_attrib(attr, val)) @@ -932,7 +932,7 @@ $endif #

method compute_position() local win,pp,px,py,pw,ph,dx,dy - win := parent.win # just to save some typing later... + win := parent.win # just to save some typing later... if \self.abs_pos_flag then { # compute position relative to screen pw := WAttrib(win,"displaywidth") ph := WAttrib(win,"displayheight") @@ -941,7 +941,7 @@ $endif self.y := parse_pos(ph, self.y_spec) | fatal("invalid y position specification: "||image(self.y_spec)) } - else { # compute position relative to parent window + else { # compute position relative to parent window pp := WAttrib(win,"pos") pp ? { px := integer(1(tab(upto(",")),move(1))) @@ -969,7 +969,7 @@ $endif end #

- # Change the expected location of the dialog relative to the + # Change the expected location of the dialog relative to the # upper-left corner of the display. Position specifications # can be given in either absolute pixels or as a percentages # of total range. See comments for Component.set_pos() diff --git a/uni/gui/drawscrollarea.icn b/uni/gui/drawscrollarea.icn index 1d0e42eb8..e5bfd9122 100644 --- a/uni/gui/drawscrollarea.icn +++ b/uni/gui/drawscrollarea.icn @@ -18,8 +18,8 @@ class DrawScrollAreaView : Component() if /self.transparent then{ dwin := self.cbwin EraseRectangle(dwin, x, y, w, h) - } - else{ + } + else{ dwin := self.cwin } @@ -32,7 +32,7 @@ class DrawScrollAreaView : Component() Clip(parent.cwin, x, y, w, h) parent.draw(parent.get_areax(), parent.get_areay(), x, y, w, h) Clip(parent.cwin) - } + } self.do_shading(dwin) if /buffer_flag & /self.transparent then diff --git a/uni/gui/editabletextlist.icn b/uni/gui/editabletextlist.icn index e94382513..c4b88c4b1 100644 --- a/uni/gui/editabletextlist.icn +++ b/uni/gui/editabletextlist.icn @@ -25,9 +25,9 @@ class Keybindings(keymap) end method set_key(e,m,ems[]) repeat { - keymap[e] := m - if not (e := pop(ems) & m := pop(ems)) then break - } + keymap[e] := m + if not (e := pop(ems) & m := pop(ems)) then break + } end # The original/default Unicon EditableTextList keybindings. # Resets the keymap, in case other keys have been bound strangely. @@ -140,18 +140,18 @@ class EditableTextList : LineBasedScrollArea( # method contents_changed() if *self.contents = 0 then - # - # Must have somewhere for the cursor to go. - # - self.contents := [""] + # + # Must have somewhere for the cursor to go. + # + self.contents := [""] clear_view_list() clear_mark() if is_dialog_open() then { - self.cursor_y >:= *self.contents - self.cursor_x >:= *self.contents[self.cursor_y] + 1 - compute_and_invalidate() - constrain_line() + self.cursor_y >:= *self.contents + self.cursor_x >:= *self.contents[self.cursor_y] + 1 + compute_and_invalidate() + constrain_line() } undo_manager.clear() end @@ -169,7 +169,7 @@ class EditableTextList : LineBasedScrollArea( dest := self.contents[n] i := 1 while (i <= *dest) & (TextWidthEx(cwin, dest, 1, i, tab_width) < d) do - i +:= 1 + i +:= 1 self.cursor_x := i self.cursor_y := n @@ -187,36 +187,36 @@ class EditableTextList : LineBasedScrollArea( vi := get_view_list_index() if vi < self.get_first_line() then { - v := view_list[self.get_first_line()] - self.cursor_y := v.index - self.cursor_x := v.first - } + v := view_list[self.get_first_line()] + self.cursor_y := v.index + self.cursor_x := v.first + } else if vi >= self.get_first_line() + self.get_max_lines() then { - v := view_list[self.get_first_line() + self.get_max_lines() - 1] - self.cursor_y := v.index - self.cursor_x := v.first - } + v := view_list[self.get_first_line() + self.get_max_lines() - 1] + self.cursor_y := v.index + self.cursor_x := v.first + } else { - v := view_list[vi] - } + v := view_list[vi] + } s := v.str i := TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) j := i + CharWidth(self.cwin, s[self.cursor_x - v.first + 1]) l := self.get_left_pos() if self.view.x - l > i then { - while (self.cursor_x - v.first + 1 < *s) & - (TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) < - view.x - l) do { - cursor_x +:= 1 - } - } + while (self.cursor_x - v.first + 1 < *s) & + (TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) < + view.x - l) do { + cursor_x +:= 1 + } + } else if self.view.x - l + self.view.w < j then { - while (self.cursor_x - v.first + 1 > 1) & - TextWidthEx(cwin, s, 1, cursor_x - v.first + 2, tab_width) > - view.x - l + view.w do { - cursor_x -:= 1 - } + while (self.cursor_x - v.first + 1 > 1) & + TextWidthEx(cwin, s, 1, cursor_x - v.first + 2, tab_width) > + view.x - l + view.w do { + cursor_x -:= 1 + } } end @@ -228,36 +228,36 @@ class EditableTextList : LineBasedScrollArea( local vi, v, s, i, j, l if not (vi := get_view_list_index()) then { - # serious error, what to do? - fail - } + # serious error, what to do? + fail + } if \vi < self.get_first_line() then - self.vsb.set_value(self.line_height * (\vi - 1)) + self.vsb.set_value(self.line_height * (\vi - 1)) else if \vi > self.get_last_line() then - self.vsb.set_value(self.line_height * (\vi - self.get_max_lines())) + self.vsb.set_value(self.line_height * (\vi - self.get_max_lines())) if not ( v := view_list[\vi] ) then { - # serious error, what to do? - fail - } + # serious error, what to do? + fail + } s := (\v).str i := TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) j := i + CharWidth(self.cwin, s[self.cursor_x - v.first + 1]) l := self.get_left_pos() if \self.hsb then { if self.view.x - l > \i then - self.hsb.set_value(i) + self.hsb.set_value(i) else if self.view.x - l + self.view.w < \j then - self.hsb.set_value(j - self.view.w) + self.hsb.set_value(j - self.view.w) } end method handle_cut(e) start_handle(e) if has_region() then { - get_clipboard().set_content(get_region()) - delete_region(e) + get_clipboard().set_content(get_region()) + delete_region(e) } end_handle(e) end @@ -265,7 +265,7 @@ class EditableTextList : LineBasedScrollArea( method handle_copy(e) start_handle(e) if has_region() then { - get_clipboard().set_content(get_region()) + get_clipboard().set_content(get_region()) } end_handle(e) end @@ -285,8 +285,8 @@ class EditableTextList : LineBasedScrollArea( # Apply the filter to the string to paste s := "" every c := !t do { - if member(printable, c) then - s ||:= c + if member(printable, c) then + s ||:= c } if *s = 0 then fail return s @@ -297,19 +297,19 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) if s := get_pasteable_clipboard() then { - ce := CompoundEdit() - - if has_region() then { - ed := EditableTextListDeleteRegionEdit(self) - ed.redo() - ce.add_edit(ed) - } - ed := EditableTextListPasteEdit(self, s) - ed.redo() - ce.add_edit(ed) - ce.close() - undo_manager.add_edit(ce) - changed := 1 + ce := CompoundEdit() + + if has_region() then { + ed := EditableTextListDeleteRegionEdit(self) + ed.redo() + ce.add_edit(ed) + } + ed := EditableTextListPasteEdit(self, s) + ed.redo() + ce.add_edit(ed) + ce.close() + undo_manager.add_edit(ce) + changed := 1 } end_handle(e) end @@ -340,30 +340,30 @@ class EditableTextList : LineBasedScrollArea( method end_handle(e) local hr, moved if \changed then { - if (*view_list ~= old_view_list_size) | - (old_mw ~= long_line.tw) then { - # - # Contents changed. Re-compute all internal fields, ensure on - # screen and re-display whole object. - # - self.set_internal_fields() - self.constrain_line() - self.invalidate() - } - else { - self.constrain_line() - self.refresh(1) - } - fire(CONTENT_CHANGED_EVENT, e) - } + if (*view_list ~= old_view_list_size) | + (old_mw ~= long_line.tw) then { + # + # Contents changed. Re-compute all internal fields, ensure on + # screen and re-display whole object. + # + self.set_internal_fields() + self.constrain_line() + self.invalidate() + } + else { + self.constrain_line() + self.refresh(1) + } + fire(CONTENT_CHANGED_EVENT, e) + } if (cursor_x ~= old_cursor_x) | (cursor_y ~= old_cursor_y) then { - moved := 1 - if /changed then { - self.constrain_line() - self.refresh(1) - } - fire(CURSOR_MOVED_EVENT, e) + moved := 1 + if /changed then { + self.constrain_line() + self.refresh(1) + } + fire(CURSOR_MOVED_EVENT, e) } # @@ -373,10 +373,10 @@ class EditableTextList : LineBasedScrollArea( # hr := has_region() if (/old_has_region & \hr) | (\old_has_region & /hr) | - (\hr & (\moved | \changed)) then { - self.invalidate() - fire(SELECTION_CHANGED_EVENT, e) - } + (\hr & (\moved | \changed)) then { + self.invalidate() + fire(SELECTION_CHANGED_EVENT, e) + } end method handle_event(e) @@ -384,13 +384,13 @@ class EditableTextList : LineBasedScrollArea( (\self.hsb).handle_event(e) if e === (&lpress | &rpress | &mpress) then - handle_press(e) + handle_press(e) else if e === (&ldrag | &rdrag | &mdrag) then - handle_drag(e) + handle_drag(e) else if e === (&lrelease | &rrelease | &mrelease) then - handle_release(e) + handle_release(e) else if \self.has_focus then { - self.__m[\ (kmap.handle_key(e))](self,e) + self.__m[\ (kmap.handle_key(e))](self,e) } end @@ -403,7 +403,7 @@ class EditableTextList : LineBasedScrollArea( l := (&y - self.view.y) / self.line_height nlines := self.get_curr_lines() if nlines = 0 then # there are no lines of text, hence no cursor - fail + fail l <:= 0 l >:= nlines - 1 @@ -414,7 +414,7 @@ class EditableTextList : LineBasedScrollArea( i := 1 l := self.get_left_pos() while (i < *s) & (TextWidthEx(cwin, s, 1, i + 1, tab_width) < &x - l) do - i+:= 1 + i+:= 1 self.cursor_x := v.first + i - 1 end @@ -430,14 +430,14 @@ class EditableTextList : LineBasedScrollArea( method handle_press(e) start_handle(e) if ((x <= &x < x + view.w + 2 * DEFAULT_TEXT_X_SURROUND) & - (y <= &y < y + view.h + 2 * DEFAULT_TEXT_Y_SURROUND)) then { - # - # Button down in region - move to cursor position. - # - set_cursor_from_pos() - self.mark_y := self.cursor_y - self.mark_x := self.cursor_x - self.is_held := 1 + (y <= &y < y + view.h + 2 * DEFAULT_TEXT_Y_SURROUND)) then { + # + # Button down in region - move to cursor position. + # + set_cursor_from_pos() + self.mark_y := self.cursor_y + self.mark_x := self.cursor_x + self.is_held := 1 } end_handle(e) end @@ -445,8 +445,8 @@ class EditableTextList : LineBasedScrollArea( method handle_undo(e) start_handle(e) if undo_manager.can_undo() then { - undo_manager.undo() - changed := 1 + undo_manager.undo() + changed := 1 } end_handle(e) end @@ -454,8 +454,8 @@ class EditableTextList : LineBasedScrollArea( method handle_redo(e) start_handle(e) if undo_manager.can_redo() then { - undo_manager.redo() - changed := 1 + undo_manager.redo() + changed := 1 } end_handle(e) end @@ -471,11 +471,11 @@ class EditableTextList : LineBasedScrollArea( &window := parent_dialog.win # cursor_x := cursor_y := 1 if TextDialog("String to seek: ",,findstr,1)=="Okay" then { - parent_dialog.resize() - if findstr ~===:= dialog_value[1] then - findstring(findstr, 1, 1) - else - findstring(findstr, , cursor_x+1) + parent_dialog.resize() + if findstr ~===:= dialog_value[1] then + findstring(findstr, 1, 1) + else + findstring(findstr, , cursor_x+1) } first_x := (cursor_x-*dialog_value[1]) second_x := cursor_x @@ -495,17 +495,17 @@ class EditableTextList : LineBasedScrollArea( i := startline foundline := &null while L[i] do { - if j := find(s, L[i], startcol) then { - foundline := i - foundcol := j - goto_line(i,1) - cursor_x := j + *s - constrain_line() - refresh(1) - return - } - i +:= 1 - startcol := 1 + if j := find(s, L[i], startcol) then { + foundline := i + foundcol := j + goto_line(i,1) + cursor_x := j + *s + constrain_line() + refresh(1) + return + } + i +:= 1 + startcol := 1 } end @@ -515,7 +515,7 @@ class EditableTextList : LineBasedScrollArea( cursor_x := cn constrain_line() refresh(1) - return + return } end @@ -532,32 +532,32 @@ class EditableTextList : LineBasedScrollArea( method handle_find_next() if \findstr then { - findstring(findstr, cursor_y, cursor_x+1) - handle_select_str(&null, (cursor_x-*findstr), cursor_x, cursor_y) + findstring(findstr, cursor_y, cursor_x+1) + handle_select_str(&null, (cursor_x-*findstr), cursor_x, cursor_y) } end method handle_drag(e) start_handle(e) if \self.is_held then { - if &y < self.y then - direction := "up" - else if &y >= self.y + self.view.h + 2 * DEFAULT_TEXT_Y_SURROUND then - direction := "down" - else if &x < self.x then - direction := "left" - else if &x >= self.x + self.view.w + 2 * DEFAULT_TEXT_X_SURROUND then - direction := "right" - else - direction := &null - - if /direction then { - stop_ticker() - set_cursor_from_pos() - } - else { - is_ticking() | set_ticker(30) - } + if &y < self.y then + direction := "up" + else if &y >= self.y + self.view.h + 2 * DEFAULT_TEXT_Y_SURROUND then + direction := "down" + else if &x < self.x then + direction := "left" + else if &x >= self.x + self.view.w + 2 * DEFAULT_TEXT_X_SURROUND then + direction := "right" + else + direction := &null + + if /direction then { + stop_ticker() + set_cursor_from_pos() + } + else { + is_ticking() | set_ticker(30) + } } end_handle(e) end @@ -568,67 +568,67 @@ class EditableTextList : LineBasedScrollArea( vi := get_view_list_index() case self.direction of { - "up" : { - if vi > 1 then { - v := view_list[vi - 1] - self.cursor_y := v.index - self.cursor_x := v.first - } - } - "down" : { - if vi < *view_list then { - v := view_list[vi + 1] - self.cursor_y := v.index - self.cursor_x := v.first - } - } - "left" : { - v := view_list[vi] - l := self.get_left_pos() - s := v.str - while (self.cursor_x - v.first + 1 > 1) & - TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) >= - view.x - l do { - cursor_x -:= 1 - } - } - "right" : { - v := view_list[vi] - l := self.get_left_pos() - s := v.str - while (self.cursor_x - v.first + 1 < *s) & - TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) < - view.x - l + view.w do { - cursor_x +:= 1 - } - } - } + "up" : { + if vi > 1 then { + v := view_list[vi - 1] + self.cursor_y := v.index + self.cursor_x := v.first + } + } + "down" : { + if vi < *view_list then { + v := view_list[vi + 1] + self.cursor_y := v.index + self.cursor_x := v.first + } + } + "left" : { + v := view_list[vi] + l := self.get_left_pos() + s := v.str + while (self.cursor_x - v.first + 1 > 1) & + TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) >= + view.x - l do { + cursor_x -:= 1 + } + } + "right" : { + v := view_list[vi] + l := self.get_left_pos() + s := v.str + while (self.cursor_x - v.first + 1 < *s) & + TextWidthEx(cwin, s, 1, cursor_x - v.first + 1, tab_width) < + view.x - l + view.w do { + cursor_x +:= 1 + } + } + } end_handle(e) end method handle_release(e) start_handle(e) if \is_held then { - # - # Mouse released after being held down. Clear flag. If there - # is no region (mouse released where it was pressed), then clear - # the mark. This prevents selecting when using the scrollbars - # after release. - # - is_held := &null - has_region() | clear_mark() - stop_ticker() + # + # Mouse released after being held down. Clear flag. If there + # is no region (mouse released where it was pressed), then clear + # the mark. This prevents selecting when using the scrollbars + # after release. + # + is_held := &null + has_region() | clear_mark() + stop_ticker() } end_handle(e) end method keyboard_mark() if &shift then { - /mark_x := cursor_x - /mark_y := cursor_y - } + /mark_x := cursor_x + /mark_y := cursor_y + } else - clear_mark() + clear_mark() end method handle_start_of_line(e) @@ -686,14 +686,14 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) keyboard_mark() if self.cursor_x = 1 then { - if self.cursor_y > 1 then { - self.cursor_y -:= 1 - self.cursor_x := *self.contents[self.cursor_y] + 1 - } - } + if self.cursor_y > 1 then { + self.cursor_y -:= 1 + self.cursor_x := *self.contents[self.cursor_y] + 1 + } + } else { - self.cursor_x -:= 1 - } + self.cursor_x -:= 1 + } end_handle(e) end @@ -701,14 +701,14 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) keyboard_mark() if self.cursor_x = *self.contents[self.cursor_y] + 1 then { - if self.cursor_y < *self.contents then { - self.cursor_x := 1 - self.cursor_y +:= 1 - } - } + if self.cursor_y < *self.contents then { + self.cursor_x := 1 + self.cursor_y +:= 1 + } + } else { - self.cursor_x +:= 1 - } + self.cursor_x +:= 1 + } end_handle(e) end @@ -717,9 +717,9 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) keyboard_mark() if i := (\self.vsb).get_value() then { - self.vsb.set_value(i - self.vsb.page_size) - self.constrain_cursor() - self.refresh() + self.vsb.set_value(i - self.vsb.page_size) + self.constrain_cursor() + self.refresh() } end_handle(e) end @@ -729,9 +729,9 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) keyboard_mark() if i := (\self.vsb).get_value() then { - self.vsb.set_value(i + self.vsb.page_size) - self.constrain_cursor() - self.refresh() + self.vsb.set_value(i + self.vsb.page_size) + self.constrain_cursor() + self.refresh() } end_handle(e) end @@ -740,10 +740,10 @@ class EditableTextList : LineBasedScrollArea( local ed start_handle(e) if (cursor_y < *self.contents) | (*self.contents[cursor_y] > 0) then { - ed := EditableTextListDeleteLineEdit(self) - undo_manager.add_edit(ed) - ed.redo() - changed := 1 + ed := EditableTextListDeleteLineEdit(self) + undo_manager.add_edit(ed) + ed.redo() + changed := 1 } end_handle(e) end @@ -753,20 +753,20 @@ class EditableTextList : LineBasedScrollArea( r := "" if self.mark_y < self.cursor_y then { - r := self.contents[self.mark_y][self.mark_x:0] || "\n" - every r ||:= self.contents[self.mark_y + 1 to self.cursor_y - 1] || "\n" - r ||:= self.contents[self.cursor_y][1:self.cursor_x] + r := self.contents[self.mark_y][self.mark_x:0] || "\n" + every r ||:= self.contents[self.mark_y + 1 to self.cursor_y - 1] || "\n" + r ||:= self.contents[self.cursor_y][1:self.cursor_x] } else if self.mark_y > self.cursor_y then { - r := self.contents[self.cursor_y][self.cursor_x:0] || "\n" - every r ||:= self.contents[self.cursor_y + 1 to self.mark_y - 1] || "\n" - r ||:= self.contents[self.mark_y][1:self.mark_x] + r := self.contents[self.cursor_y][self.cursor_x:0] || "\n" + every r ||:= self.contents[self.cursor_y + 1 to self.mark_y - 1] || "\n" + r ||:= self.contents[self.mark_y][1:self.mark_x] } else { - # mark_y = cursor_y - if self.mark_x < self.cursor_x then { - r := self.contents[self.cursor_y][self.mark_x:self.cursor_x] - } else { - r := self.contents[self.cursor_y][self.cursor_x:self.mark_x] - } + # mark_y = cursor_y + if self.mark_x < self.cursor_x then { + r := self.contents[self.cursor_y][self.mark_x:self.cursor_x] + } else { + r := self.contents[self.cursor_y][self.cursor_x:self.mark_x] + } } return r end @@ -784,14 +784,14 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) if has_region() then { - delete_region(e) + delete_region(e) } else { - if (self.cursor_x > 1) | (self.cursor_y > 1) then { - ed := EditableTextListDeleteLeftEdit(self) - undo_manager.add_edit(ed) - ed.redo() - changed := 1 - } + if (self.cursor_x > 1) | (self.cursor_y > 1) then { + ed := EditableTextListDeleteLeftEdit(self) + undo_manager.add_edit(ed) + ed.redo() + changed := 1 + } } end_handle(e) end @@ -801,14 +801,14 @@ class EditableTextList : LineBasedScrollArea( start_handle(e) if has_region() then { - delete_region(e) + delete_region(e) } else { - if (self.cursor_x <= *contents[cursor_y]) | (self.cursor_y < *contents) then { - ed := EditableTextListDeleteRightEdit(self) - undo_manager.add_edit(ed) - ed.redo() - changed := 1 - } + if (self.cursor_x <= *contents[cursor_y]) | (self.cursor_y < *contents) then { + ed := EditableTextListDeleteRightEdit(self) + undo_manager.add_edit(ed) + ed.redo() + changed := 1 + } } end_handle(e) end @@ -831,26 +831,26 @@ class EditableTextList : LineBasedScrollArea( # Add any printable character at cursor position # if type(e) == "string" & not(&control | &meta) & any(printable, e) then { - if has_region() then { - ed := EditableTextListDeleteRegionEdit(self) - ed.redo() - undo_manager.add_edit(ed) - ed := EditableTextListDefaultEdit(self, e) - ed.redo() - undo_manager.add_edit(ed) - } else { - ed := EditableTextListDefaultEdit(self, e) - ed.redo() - undo_manager.add_edit(ed) - } - changed := 1 + if has_region() then { + ed := EditableTextListDeleteRegionEdit(self) + ed.redo() + undo_manager.add_edit(ed) + ed := EditableTextListDefaultEdit(self, e) + ed.redo() + undo_manager.add_edit(ed) + } else { + ed := EditableTextListDefaultEdit(self, e) + ed.redo() + undo_manager.add_edit(ed) + } + changed := 1 } end_handle(e) end method resize() if \wrap_mode == "width" then - clear_view_list() + clear_view_list() self.ScrollArea.resize() self.constrain_line() @@ -862,13 +862,13 @@ class EditableTextList : LineBasedScrollArea( had_vsb := self.vsb if /view_list then - create_view_list() + create_view_list() self.ScrollArea.set_internal_fields() if \wrap_mode == "width" & had_vsb ~=== self.vsb then { - create_view_list() - set_internal_fields() + create_view_list() + set_internal_fields() } end @@ -902,8 +902,8 @@ class EditableTextList : LineBasedScrollArea( # Write the lines # every i := first_line to last_line do { - draw_line(xp, yp, i, dwin) - yp +:= self.line_height + draw_line(xp, yp, i, dwin) + yp +:= self.line_height } return end @@ -917,74 +917,74 @@ class EditableTextList : LineBasedScrollArea( si := self.cursor_x - v.first + 1 if (v.index = \self.cursor_y) & (v.first <= \self.cursor_x <= v.last) then { - if \self.has_focus then { -# if s[si] ~== "\t" then -# left_string(cw, xp + off, yp, s[si]) - CursorLine(dwin, - xp + TextWidthEx(dwin, s, 1, si, self.tab_width), - 1 + yp - self.line_height / 2, - CharWidth(dwin, s[si]), - self.line_height) - } + if \self.has_focus then { +# if s[si] ~== "\t" then +# left_string(cw, xp + off, yp, s[si]) + CursorLine(dwin, + xp + TextWidthEx(dwin, s, 1, si, self.tab_width), + 1 + yp - self.line_height / 2, + CharWidth(dwin, s[si]), + self.line_height) + } } if \self.mark_y then { - if (self.mark_y < v.index < self.cursor_y) | (self.mark_y > v.index > self.cursor_y) then { - # Whole line selected - r := [v.first, v.last] - } else if v.index = self.mark_y = self.cursor_y then { - # Part of line - if self.mark_x < self.cursor_x then { - r := range(v.first, v.last, self.mark_x, self.cursor_x) - } - else if self.mark_x > self.cursor_x then { - r := range(v.first, v.last, self.cursor_x + 1 , self.mark_x) - do_r1 := 1 - } - } else if v.index = self.mark_y then { - if self.mark_y < self.cursor_y then { - r := range(v.first, v.last, self.mark_x, - *self.contents[v.index] + 1) - } else { - r := range(v.first, v.last, 1, self.mark_x) - } - } else if v.index = self.cursor_y then { - if self.mark_y > self.cursor_y then { - r := range(v.first, v.last, self.cursor_x + 1, - *self.contents[v.index] + 1) - do_r1 := 1 - } else { - r := range(v.first, v.last, 1, self.cursor_x) - } - } - - if \r then { - if /do_r1 then r1:=r[1] - else r1 := 1<=r[1]-1 | 1 - - off1 := TextWidthEx(dwin, s, 1, r1 - v.first + 1, - self.tab_width) - off2 := TextWidthEx(dwin, s, 1, r[2] - v.first + 1, - self.tab_width) - - fc := Fg(dwin) - Fg(dwin, "blue") - - FillRectangle(dwin, xp + off1, 1 + yp - self.line_height / 2, - off2 - off1, self.line_height) - - Fg(dwin, "white") - left_string(dwin, xp+off1, yp, ds[r1:r[2]]) - - Fg(dwin, fc) - left_string(dwin, xp, yp, ds[1:r1]) - left_string(dwin, xp+off2, yp, ds[r[2]:0]) - } + if (self.mark_y < v.index < self.cursor_y) | (self.mark_y > v.index > self.cursor_y) then { + # Whole line selected + r := [v.first, v.last] + } else if v.index = self.mark_y = self.cursor_y then { + # Part of line + if self.mark_x < self.cursor_x then { + r := range(v.first, v.last, self.mark_x, self.cursor_x) + } + else if self.mark_x > self.cursor_x then { + r := range(v.first, v.last, self.cursor_x + 1 , self.mark_x) + do_r1 := 1 + } + } else if v.index = self.mark_y then { + if self.mark_y < self.cursor_y then { + r := range(v.first, v.last, self.mark_x, + *self.contents[v.index] + 1) + } else { + r := range(v.first, v.last, 1, self.mark_x) + } + } else if v.index = self.cursor_y then { + if self.mark_y > self.cursor_y then { + r := range(v.first, v.last, self.cursor_x + 1, + *self.contents[v.index] + 1) + do_r1 := 1 + } else { + r := range(v.first, v.last, 1, self.cursor_x) + } + } + + if \r then { + if /do_r1 then r1:=r[1] + else r1 := 1<=r[1]-1 | 1 + + off1 := TextWidthEx(dwin, s, 1, r1 - v.first + 1, + self.tab_width) + off2 := TextWidthEx(dwin, s, 1, r[2] - v.first + 1, + self.tab_width) + + fc := Fg(dwin) + Fg(dwin, "blue") + + FillRectangle(dwin, xp + off1, 1 + yp - self.line_height / 2, + off2 - off1, self.line_height) + + Fg(dwin, "white") + left_string(dwin, xp+off1, yp, ds[r1:r[2]]) + + Fg(dwin, fc) + left_string(dwin, xp, yp, ds[1:r1]) + left_string(dwin, xp+off2, yp, ds[r[2]:0]) + } else - left_string(dwin, xp, yp, ds) - } + left_string(dwin, xp, yp, ds) + } else - left_string(dwin, xp, yp, ds) + left_string(dwin, xp, yp, ds) end @@ -995,23 +995,23 @@ class EditableTextList : LineBasedScrollArea( # @p method range(f1, t1, f2, t2) if f1 < f2 then { - if t1 >= f2 then { - if t1 >= t2 then { - return [f2, t2] - } - else { - return [f2, t1] - } - } + if t1 >= f2 then { + if t1 >= t2 then { + return [f2, t2] + } + else { + return [f2, t1] + } + } } else { - if f1 <= t2 then { - if t1 >= t2 then { - return [f1, t2] - } - else { - return [f1, t1] - } - } + if f1 <= t2 then { + if t1 >= t2 then { + return [f1, t2] + } + else { + return [f1, t1] + } + } } end @@ -1047,14 +1047,14 @@ class EditableTextList : LineBasedScrollArea( j := *view_list while i <= j do { - mid := (i+j) / 2 - v := view_list[mid] - if (v.index = y) & (v.first <= x <= v.last) then - return mid - if (v.index < y) | (v.index = y & v.last < x) then - i := mid + 1 - else - j := mid - 1 + mid := (i+j) / 2 + v := view_list[mid] + if (v.index = y) & (v.first <= x <= v.last) then + return mid + if (v.index < y) | (v.index = y & v.last < x) then + i := mid + 1 + else + j := mid - 1 } end @@ -1066,14 +1066,14 @@ class EditableTextList : LineBasedScrollArea( view_list := [] every i := 1 to *self.contents do { - pos := 1 - s := self.contents[i] || " " - every j := line_splitter.split(s) do { - p := s[pos:j] - put(view_list, ViewLine(i, p, pos, j - 1, - TextWidthEx(cwin, p,,, tab_width))) - pos := j - } + pos := 1 + s := self.contents[i] || " " + every j := line_splitter.split(s) do { + p := s[pos:j] + put(view_list, ViewLine(i, p, pos, j - 1, + TextWidthEx(cwin, p,,, tab_width))) + pos := j + } } find_long_line() @@ -1094,8 +1094,8 @@ class EditableTextList : LineBasedScrollArea( local v long_line := view_list[1] every v := !view_list do { - if v.tw > long_line.tw then - long_line := v + if v.tw > long_line.tw then + long_line := v } end @@ -1113,38 +1113,38 @@ class EditableTextList : LineBasedScrollArea( vi := get_view_list_index(1, index) while view_list[vi].index <= index + del - 1 do { - if view_list[vi] === long_line then - long_line := &null - delete(view_list, vi) + if view_list[vi] === long_line then + long_line := &null + delete(view_list, vi) } if /long_line then - find_long_line() + find_long_line() every i := index to index + add - 1 do { - pos := 1 - s := self.contents[i] || " " - every j := line_splitter.split(s) do { - p := s[pos:j] - v := ViewLine(i, p, pos, j - 1, TextWidthEx(cwin, p,,, tab_width)) - - if vi > *view_list then - put(view_list, v) - else - insert(view_list, vi, v) - - if /long_line | (v.tw > long_line.tw) then - long_line := v - pos := j - vi +:= 1 - } + pos := 1 + s := self.contents[i] || " " + every j := line_splitter.split(s) do { + p := s[pos:j] + v := ViewLine(i, p, pos, j - 1, TextWidthEx(cwin, p,,, tab_width)) + + if vi > *view_list then + put(view_list, v) + else + insert(view_list, vi, v) + + if /long_line | (v.tw > long_line.tw) then + long_line := v + pos := j + vi +:= 1 + } } # # Adjust index values # if del ~= add then - every view_list[vi to *view_list].index +:= (add - del) + every view_list[vi to *view_list].index +:= (add - del) end # @@ -1161,18 +1161,18 @@ class EditableTextList : LineBasedScrollArea( local wc self.wrap_mode := s if /s | s == ("" | "false" | "off" | "no") then - line_splitter := DefaultLineSplitter(self) + line_splitter := DefaultLineSplitter(self) else if wc := integer(s) then - line_splitter := ColumnLineSplitter(self, wc) + line_splitter := ColumnLineSplitter(self, wc) else if s == "width" then - line_splitter := WidthLineSplitter(self) + line_splitter := WidthLineSplitter(self) else - field_error("Bad wrap mode:" || s) + field_error("Bad wrap mode:" || s) clear_view_list() if is_dialog_open() then { - compute_and_invalidate() - constrain_line() + compute_and_invalidate() + constrain_line() } end @@ -1183,17 +1183,17 @@ class EditableTextList : LineBasedScrollArea( self.tab_width := n clear_view_list() if is_dialog_open() then { - compute_and_invalidate() - constrain_line() + compute_and_invalidate() + constrain_line() } end method set_one(attr, val) case attr of { - "wrap_mode": set_wrap_mode(string_val(attr, val)) - "tab_width": set_tab_width(int_val(attr, val)) - "contents" : set_contents(val) - default: self.LineBasedScrollArea.set_one(attr, val) + "wrap_mode": set_wrap_mode(string_val(attr, val)) + "tab_width": set_tab_width(int_val(attr, val)) + "contents" : set_contents(val) + default: self.LineBasedScrollArea.set_one(attr, val) } end @@ -1210,21 +1210,21 @@ initially(a[]) end class ViewLine:Object(index, - str, - first, - last, - tw) + str, + first, + last, + tw) method to_string() return "ViewLine(" || index || "," || str || "," || first || "," || last || ")" end end class EditableTextListEdit:UndoableEdit(parent, - cursor_x, - cursor_y, - mark_x, - mark_y - ) + cursor_x, + cursor_y, + mark_x, + mark_y + ) method redo() restore() self.redo_impl() @@ -1260,18 +1260,18 @@ end class EditableTextListDefaultEdit:EditableTextListEdit(s) method add_edit(other) if is_instance(other, "gui::EditableTextListDefaultEdit") & - (other.cursor_y = self.cursor_y) & - (other.cursor_x = self.cursor_x + *s) then { - s ||:= other.s - return + (other.cursor_y = self.cursor_y) & + (other.cursor_x = self.cursor_x + *s) then { + s ||:= other.s + return } end method redo_impl() if parent.cursor_x = 1 then - parent.contents[parent.cursor_y] := s || parent.contents[parent.cursor_y] + parent.contents[parent.cursor_y] := s || parent.contents[parent.cursor_y] else - parent.contents[parent.cursor_y][parent.cursor_x - 1] ||:= s + parent.contents[parent.cursor_y][parent.cursor_x - 1] ||:= s parent.cursor_x +:= *s parent.clear_mark() parent.update_view_list(parent.cursor_y, 1, 1) @@ -1296,12 +1296,12 @@ class EditableTextListReturnEdit:EditableTextListEdit() parent.update_view_list(parent.cursor_y, 1, 2) if (\ (parent.mark_y) > parent.cursor_y) | - (\ (parent.mark_y) = parent.cursor_y & - \ (parent.mark_x) >= parent.cursor_x) then { - # Mark was after insertion. Push the mark forward. - parent.mark_y +:= 1 - parent.mark_x -:= (parent.cursor_x-1) - } + (\ (parent.mark_y) = parent.cursor_y & + \ (parent.mark_x) >= parent.cursor_x) then { + # Mark was after insertion. Push the mark forward. + parent.mark_y +:= 1 + parent.mark_x -:= (parent.cursor_x-1) + } parent.cursor_y +:= 1 parent.cursor_x := 1 @@ -1320,15 +1320,15 @@ end class EditableTextListDeleteRightEdit:EditableTextListEdit(ch) method redo_impl() if parent.cursor_x = *parent.contents[parent.cursor_y] + 1 then { - # We know cursor_y < *contents from the handle method above. - parent.contents[parent.cursor_y] ||:= parent.contents[parent.cursor_y + 1] - parent.contents := parent.contents[1:parent.cursor_y + 1] ||| parent.contents[parent.cursor_y + 2 : 0] - parent.update_view_list(parent.cursor_y, 2, 1) + # We know cursor_y < *contents from the handle method above. + parent.contents[parent.cursor_y] ||:= parent.contents[parent.cursor_y + 1] + parent.contents := parent.contents[1:parent.cursor_y + 1] ||| parent.contents[parent.cursor_y + 2 : 0] + parent.update_view_list(parent.cursor_y, 2, 1) } else { - # Cursor not at end of line - ch := parent.contents[parent.cursor_y][parent.cursor_x] - parent.contents[parent.cursor_y][parent.cursor_x] := "" - parent.update_view_list(parent.cursor_y, 1, 1) + # Cursor not at end of line + ch := parent.contents[parent.cursor_y][parent.cursor_x] + parent.contents[parent.cursor_y][parent.cursor_x] := "" + parent.update_view_list(parent.cursor_y, 1, 1) } parent.clear_mark() end @@ -1336,16 +1336,16 @@ class EditableTextListDeleteRightEdit:EditableTextListEdit(ch) method undo_impl() local t if /ch then { - t := parent.contents[self.cursor_y][self.cursor_x:0] - parent.contents[self.cursor_y][self.cursor_x:0] := "" - insert(parent.contents, self.cursor_y + 1, t) - parent.update_view_list(self.cursor_y, 1, 2) + t := parent.contents[self.cursor_y][self.cursor_x:0] + parent.contents[self.cursor_y][self.cursor_x:0] := "" + insert(parent.contents, self.cursor_y + 1, t) + parent.update_view_list(self.cursor_y, 1, 2) } else { - if self.cursor_x > *parent.contents[self.cursor_y] then - parent.contents[self.cursor_y] ||:= ch - else - parent.contents[self.cursor_y][self.cursor_x] := ch || parent.contents[self.cursor_y][self.cursor_x] - parent.update_view_list(self.cursor_y, 1, 1) + if self.cursor_x > *parent.contents[self.cursor_y] then + parent.contents[self.cursor_y] ||:= ch + else + parent.contents[self.cursor_y][self.cursor_x] := ch || parent.contents[self.cursor_y][self.cursor_x] + parent.update_view_list(self.cursor_y, 1, 1) } end @@ -1356,18 +1356,18 @@ end class EditableTextListDeleteLeftEdit:EditableTextListEdit(ch, cut) method redo_impl() if parent.cursor_x = 1 then { - # We know parent.cursor_y > 1 from the handle method - cut := parent.cursor_x := *parent.contents[parent.cursor_y - 1] + 1 - parent.contents[parent.cursor_y - 1] ||:= parent.contents[parent.cursor_y] - parent.contents := parent.contents[1:parent.cursor_y] ||| parent.contents[parent.cursor_y + 1 : 0] - parent.update_view_list(parent.cursor_y - 1, 2, 1) - parent.cursor_y -:= 1 + # We know parent.cursor_y > 1 from the handle method + cut := parent.cursor_x := *parent.contents[parent.cursor_y - 1] + 1 + parent.contents[parent.cursor_y - 1] ||:= parent.contents[parent.cursor_y] + parent.contents := parent.contents[1:parent.cursor_y] ||| parent.contents[parent.cursor_y + 1 : 0] + parent.update_view_list(parent.cursor_y - 1, 2, 1) + parent.cursor_y -:= 1 } else { - # parent.cursor_x > 1 - ch := parent.contents[parent.cursor_y][parent.cursor_x - 1] - parent.contents[parent.cursor_y][parent.cursor_x - 1] := "" - parent.cursor_x -:= 1 - parent.update_view_list(parent.cursor_y, 1, 1) + # parent.cursor_x > 1 + ch := parent.contents[parent.cursor_y][parent.cursor_x - 1] + parent.contents[parent.cursor_y][parent.cursor_x - 1] := "" + parent.cursor_x -:= 1 + parent.update_view_list(parent.cursor_y, 1, 1) } parent.clear_mark() end @@ -1375,16 +1375,16 @@ class EditableTextListDeleteLeftEdit:EditableTextListEdit(ch, cut) method undo_impl() local t if /ch then { - t := parent.contents[self.cursor_y - 1][cut:0] - parent.contents[self.cursor_y - 1][cut:0] := "" - insert(parent.contents, self.cursor_y, t) - parent.update_view_list(self.cursor_y - 1, 1, 2) + t := parent.contents[self.cursor_y - 1][cut:0] + parent.contents[self.cursor_y - 1][cut:0] := "" + insert(parent.contents, self.cursor_y, t) + parent.update_view_list(self.cursor_y - 1, 1, 2) } else { - if self.cursor_x - 1 > *parent.contents[self.cursor_y] then - parent.contents[self.cursor_y] ||:= ch - else - parent.contents[self.cursor_y][self.cursor_x - 1] := ch || parent.contents[self.cursor_y][self.cursor_x - 1] - parent.update_view_list(self.cursor_y, 1, 1) + if self.cursor_x - 1 > *parent.contents[self.cursor_y] then + parent.contents[self.cursor_y] ||:= ch + else + parent.contents[self.cursor_y][self.cursor_x - 1] := ch || parent.contents[self.cursor_y][self.cursor_x - 1] + parent.update_view_list(self.cursor_y, 1, 1) } end @@ -1396,11 +1396,11 @@ class EditableTextListDeleteLineEdit:EditableTextListEdit(s) method redo_impl() s := parent.contents[parent.cursor_y] if parent.cursor_y = *parent.contents then { - parent.contents[parent.cursor_y] := "" - parent.update_view_list(parent.cursor_y, 1, 1) + parent.contents[parent.cursor_y] := "" + parent.update_view_list(parent.cursor_y, 1, 1) } else { - delete(parent.contents, parent.cursor_y) - parent.update_view_list(parent.cursor_y, 1, 0) + delete(parent.contents, parent.cursor_y) + parent.update_view_list(parent.cursor_y, 1, 0) } parent.cursor_x := 1 parent.clear_mark() @@ -1408,11 +1408,11 @@ class EditableTextListDeleteLineEdit:EditableTextListEdit(s) method undo_impl() if self.cursor_y = *parent.contents then { - parent.contents[self.cursor_y] := s - parent.update_view_list(self.cursor_y, 1, 1) + parent.contents[self.cursor_y] := s + parent.update_view_list(self.cursor_y, 1, 1) } else { - insert(parent.contents, self.cursor_y, s) - parent.update_view_list(self.cursor_y, 0, 1) + insert(parent.contents, self.cursor_y, s) + parent.update_view_list(self.cursor_y, 0, 1) } end @@ -1424,33 +1424,33 @@ class EditableTextListDeleteRegionEdit:EditableTextListEdit(l, pos) method redo_impl() l := [] if parent.mark_y < parent.cursor_y then { - pos := parent.mark_y - put(l, parent.contents[parent.mark_y]) - parent.contents[parent.mark_y] := parent.contents[parent.mark_y][1:parent.mark_x] || parent.contents[parent.cursor_y][parent.cursor_x:0] - every parent.mark_y + 1 to parent.cursor_y do { - put(l, parent.contents[parent.mark_y + 1]) - delete(parent.contents, parent.mark_y + 1) - } - parent.cursor_x := parent.mark_x - parent.cursor_y := parent.mark_y + pos := parent.mark_y + put(l, parent.contents[parent.mark_y]) + parent.contents[parent.mark_y] := parent.contents[parent.mark_y][1:parent.mark_x] || parent.contents[parent.cursor_y][parent.cursor_x:0] + every parent.mark_y + 1 to parent.cursor_y do { + put(l, parent.contents[parent.mark_y + 1]) + delete(parent.contents, parent.mark_y + 1) + } + parent.cursor_x := parent.mark_x + parent.cursor_y := parent.mark_y } else if parent.mark_y > parent.cursor_y then { - pos := parent.cursor_y - put(l, parent.contents[parent.cursor_y]) - parent.contents[parent.cursor_y] := parent.contents[parent.cursor_y][1:parent.cursor_x] || parent.contents[parent.mark_y][parent.mark_x:0] - every parent.cursor_y + 1 to parent.mark_y do { - put(l, parent.contents[parent.cursor_y + 1]) - delete(parent.contents, parent.cursor_y + 1) - } + pos := parent.cursor_y + put(l, parent.contents[parent.cursor_y]) + parent.contents[parent.cursor_y] := parent.contents[parent.cursor_y][1:parent.cursor_x] || parent.contents[parent.mark_y][parent.mark_x:0] + every parent.cursor_y + 1 to parent.mark_y do { + put(l, parent.contents[parent.cursor_y + 1]) + delete(parent.contents, parent.cursor_y + 1) + } } else { - # parent.mark_y = cursor_y - pos := parent.cursor_y - put(l, parent.contents[parent.cursor_y]) - if parent.mark_x < parent.cursor_x then { - parent.contents[parent.cursor_y][parent.mark_x:parent.cursor_x] := "" - parent.cursor_x := parent.mark_x - } else { - parent.contents[parent.cursor_y][parent.cursor_x:parent.mark_x] := "" - } + # parent.mark_y = cursor_y + pos := parent.cursor_y + put(l, parent.contents[parent.cursor_y]) + if parent.mark_x < parent.cursor_x then { + parent.contents[parent.cursor_y][parent.mark_x:parent.cursor_x] := "" + parent.cursor_x := parent.mark_x + } else { + parent.contents[parent.cursor_y][parent.cursor_x:parent.mark_x] := "" + } } parent.update_view_list(pos, *l, 1) parent.clear_mark() @@ -1461,9 +1461,9 @@ class EditableTextListDeleteRegionEdit:EditableTextListEdit(l, pos) n := *l delete(parent.contents, pos) if pos > *parent.contents then - while put(parent.contents, pop(l)) + while put(parent.contents, pop(l)) else - while insert(parent.contents, pos, pull(l)) + while insert(parent.contents, pos, pull(l)) parent.update_view_list(pos, 1, n) end @@ -1479,24 +1479,24 @@ class EditableTextListPasteEdit:EditableTextListEdit(s, pre, n) pre := parent.contents[parent.cursor_y] s ? repeat { - t := tab(upto('\n') | 0) - if any('\n') then { - nl := parent.contents[parent.cursor_y][parent.cursor_x:0] - parent.contents[parent.cursor_y] := parent.contents[parent.cursor_y][1:parent.cursor_x] || t - if parent.cursor_y = *parent.contents then - put(parent.contents, nl) - else - insert(parent.contents, parent.cursor_y + 1, nl) - n +:= 1 - parent.cursor_y +:= 1 - parent.cursor_x := 1 - move(1) - } - else { - parent.contents[parent.cursor_y] := parent.contents[parent.cursor_y][1:parent.cursor_x] || t || parent.contents[parent.cursor_y][parent.cursor_x:0] - parent.cursor_x +:= *t - break - } + t := tab(upto('\n') | 0) + if any('\n') then { + nl := parent.contents[parent.cursor_y][parent.cursor_x:0] + parent.contents[parent.cursor_y] := parent.contents[parent.cursor_y][1:parent.cursor_x] || t + if parent.cursor_y = *parent.contents then + put(parent.contents, nl) + else + insert(parent.contents, parent.cursor_y + 1, nl) + n +:= 1 + parent.cursor_y +:= 1 + parent.cursor_x := 1 + move(1) + } + else { + parent.contents[parent.cursor_y] := parent.contents[parent.cursor_y][1:parent.cursor_x] || t || parent.contents[parent.cursor_y][parent.cursor_x:0] + parent.cursor_x +:= *t + break + } } parent.update_view_list(self.cursor_y, 1, n + 1) end @@ -1504,7 +1504,7 @@ class EditableTextListPasteEdit:EditableTextListEdit(s, pre, n) method undo_impl() parent.contents[self.cursor_y] := pre every 1 to n do - delete(parent.contents, self.cursor_y + 1) + delete(parent.contents, self.cursor_y + 1) parent.update_view_list(self.cursor_y, n + 1, 1) end @@ -1526,27 +1526,27 @@ class ColumnLineSplitter:LineSplitter(wrap_col) ds := "" s ? { - while ch := move(1) do { - ds ||:= ch - if *detab(ds, parent.tab_width + 1) > wrap_col then { - if *ds > 1 then { - ds[-1] := "" - move(-1) - } - if upto('\t ', ds) then { - while any(~'\t ', ds[-1]) do { - ds[-1] := "" - move(-1) - } - } - p := &pos - suspend p - ds := "" - } - - } - if p ~=== &pos then - suspend .&pos + while ch := move(1) do { + ds ||:= ch + if *detab(ds, parent.tab_width + 1) > wrap_col then { + if *ds > 1 then { + ds[-1] := "" + move(-1) + } + if upto('\t ', ds) then { + while any(~'\t ', ds[-1]) do { + ds[-1] := "" + move(-1) + } + } + p := &pos + suspend p + ds := "" + } + + } + if p ~=== &pos then + suspend .&pos } end @@ -1566,36 +1566,36 @@ class WidthLineSplitter:LineSplitter() local ch, ds, p, width if \parent.draw_border_flag then { - width := parent.w - 2 * parent.get_view_x_padding() + width := parent.w - 2 * parent.get_view_x_padding() } else { - width := parent.w + width := parent.w } if \parent.vsb then - width -:= SB_SIZE + width -:= SB_SIZE ds := "" s ? { - while ch := move(1) do { - ds ||:= ch - if TextWidthEx(parent.cwin, ds,,, parent.tab_width) > width then { - if *ds > 1 then { - ds[-1] := "" - move(-1) - } - if upto('\t ', ds) then { - while any(~'\t ', ds[-1]) do { - ds[-1] := "" - move(-1) - } - } - p := &pos - suspend p - ds := "" - } - - } - if p ~=== &pos then - suspend .&pos + while ch := move(1) do { + ds ||:= ch + if TextWidthEx(parent.cwin, ds,,, parent.tab_width) > width then { + if *ds > 1 then { + ds[-1] := "" + move(-1) + } + if upto('\t ', ds) then { + while any(~'\t ', ds[-1]) do { + ds[-1] := "" + move(-1) + } + } + p := &pos + suspend p + ds := "" + } + + } + if p ~=== &pos then + suspend .&pos } end diff --git a/uni/gui/image.icn b/uni/gui/image.icn index 953b4c07f..414185c2f 100644 --- a/uni/gui/image.icn +++ b/uni/gui/image.icn @@ -22,10 +22,10 @@ global image_cache, zoom_cache # set with {set_size()}. # class Image : Component( - filename, # - scale_up_flag, # + filename, # + scale_up_flag, # cache_image_flag, - x_internal_alignment, # + x_internal_alignment, # y_internal_alignment # ) @@ -54,9 +54,9 @@ class Image : Component( # # If set, then the image will be scaled up to fit in the space - # specified by {set_size()}. The image will not be distorted, - # but will be expanded to fill one of the dimensions depending - # on its shape. If the image is bigger than the specified size + # specified by {set_size()}. The image will not be distorted, + # but will be expanded to fill one of the dimensions depending + # on its shape. If the image is bigger than the specified size # then it will always be scaled down. # method set_scale_up() @@ -109,7 +109,7 @@ class Image : Component( aspr, aspmax, zoom_w, zoom_h, yoff, xoff, zc W := if /buffer_flag then self.cwin else self.cbwin - + EraseRectangle(W, self.x, self.y, self.w, self.h) # @@ -166,7 +166,7 @@ class Image : Component( "b" : yoff := h1 - zoom_h "c" : yoff := (h1 - zoom_h) / 2 default : fatal("incorrect y internal_alignment specifier: " || - image(self.y_internal_alignment)) + image(self.y_internal_alignment)) } case self.x_internal_alignment of { @@ -174,7 +174,7 @@ class Image : Component( "r" : xoff := w1 - zoom_w "c" : xoff := (w1 - zoom_w) / 2 default : fatal("incorrect x internal_alignment specifier: " || - image(self.x_internal_alignment)) + image(self.x_internal_alignment)) } zoom_w <:= 1 @@ -186,11 +186,11 @@ class Image : Component( CopyArea(zc, W, , , , , x1 + xoff, y1 + yoff) else Zoom(imwin, W, 0, 0, img_w, img_h, - x1 + xoff, y1 + yoff, zoom_w, zoom_h) + x1 + xoff, y1 + yoff, zoom_w, zoom_h) } else { zc := WOpen("size=" || zoom_w || "," || zoom_h, "canvas=hidden") | - fatal("Couldn't open temp window") + fatal("Couldn't open temp window") Zoom(imwin, zc, 0, 0, img_w, img_h, 0, 0, zoom_w, zoom_h) insert(zoom_cache, filename, zc) CopyArea(zc, W, , , , , x1 + xoff, y1 + yoff) @@ -201,7 +201,7 @@ class Image : Component( # if \self.draw_border_flag then DrawRaisedRectangle(W, x1+xoff-BORDER_WIDTH, y1+yoff-BORDER_WIDTH, - zoom_w + 2*BORDER_WIDTH, zoom_h + 2*BORDER_WIDTH) + zoom_w + 2*BORDER_WIDTH, zoom_h + 2*BORDER_WIDTH) self.do_shading(W) end @@ -224,8 +224,8 @@ class Image : Component( else clear_cache_image() "internal_alignment" : { - set_internal_alignment!string_vals(attr, val, 2) - } + set_internal_alignment!string_vals(attr, val, 2) + } default: self.Component.set_one(attr, val) } end @@ -262,22 +262,22 @@ class TempImage : Image(basewidth, baseheight) end method display(buffer_flag) if not member(image_cache, filename) then { - insert(image_cache, filename, WOpen("canvas=hidden", "size="||basewidth||","||baseheight)) - } + insert(image_cache, filename, WOpen("canvas=hidden", "size="||basewidth||","||baseheight)) + } self.Image.display(buffer_flag) end initially(a[]) if match("width=", x := !a) then - basewidth := integer(x[7:0]) else basewidth := 64 + basewidth := integer(x[7:0]) else basewidth := 64 if match("height=", x := !a) then - baseheight := integer(x[8:0]) else baseheight := 64 + baseheight := integer(x[8:0]) else baseheight := 64 if match("size=", x := !a) then { - x[6:0] ? { - basewidth := integer(tab(many(&digits))) - ="," - baseheight := integer(tab(many(&digits))) - } + x[6:0] ? { + basewidth := integer(tab(many(&digits))) + ="," + baseheight := integer(tab(many(&digits))) + } } self.Image.initially() set_fields(a) diff --git a/uni/gui/menubar.icn b/uni/gui/menubar.icn index f07b20f22..b03419e18 100644 --- a/uni/gui/menubar.icn +++ b/uni/gui/menubar.icn @@ -24,7 +24,7 @@ $include "guih.icn" # font specified. # class MenuBar : Component( - which_highlight, # + which_highlight, # which_open, # menus # ) @@ -64,12 +64,12 @@ class MenuBar : Component( every m := !menus do { if m === \which_highlight then DrawRaisedRectangle(cbwin, m.label_x, y + BORDER_WIDTH, - m.label_mid_w, h - 2 * BORDER_WIDTH) + m.label_mid_w, h - 2 * BORDER_WIDTH) left_string(cbwin, m.label_x + DEFAULT_TEXT_X_SURROUND, y + h / 2, - m.get_label(), m.get_accel()) + m.get_label(), m.get_accel()) if \m.is_shaded_flag then FilterRectangle(cbwin, m.label_x, y + BORDER_WIDTH, - m.label_mid_w, h - 2 * BORDER_WIDTH) + m.label_mid_w, h - 2 * BORDER_WIDTH) } do_shading(cbwin) @@ -256,7 +256,7 @@ class MenuBar : Component( # if /self.which_highlight then self.unique_start() - + # # Open t, possibly just toggling the partial_flag. # @@ -281,16 +281,16 @@ class MenuBar : Component( } end - method handle_release(e) + method handle_release(e) local t if self.in_region() & \self.which_highlight then { # # Released with menu open. If not on a label then close # - if not(t := which_button()) then { + if not(t := which_button()) then { self.set_which_highlight() self.unique_end(1) - } + } } else { (\self.which_open).handle_event(e) } @@ -318,7 +318,7 @@ class MenuBar : Component( else self.set_which_open(t) } - } else + } else # # Drag with menu open, but not on a label, blank present menu leaving # sub menus open @@ -363,7 +363,7 @@ class MenuBar : Component( } /self.x_spec := 0 - /self.y_spec := 0 + /self.y_spec := 0 /self.w_spec := "100%" /self.h_spec := WAttrib(self.cwin, "fheight") + 2 * DEFAULT_TEXT_Y_SURROUND self.Component.resize() @@ -372,7 +372,7 @@ class MenuBar : Component( # px := self.x + BORDER_WIDTH every m := !self.menus do { - m.set_parent_component(self) + m.set_parent_component(self) m.set_abs_coords(px, self.y + self.h) m.set_label_pos(px, self.y + BORDER_WIDTH) m.size_label() diff --git a/uni/gui/messagebox.icn b/uni/gui/messagebox.icn index 9ee6d0ed4..c262b45fd 100644 --- a/uni/gui/messagebox.icn +++ b/uni/gui/messagebox.icn @@ -39,7 +39,7 @@ class MessageBox : Dialog(okButton, messageArea, mesg, mFont, minArea, maxArea) #

method setup() # self.set_attribs("size=644,399") # or some such - + messageArea := TextList() messageArea.attrib(\mFont) messageArea.set_pos("15", "10") @@ -50,7 +50,7 @@ class MessageBox : Dialog(okButton, messageArea, mesg, mFont, minArea, maxArea) okButton.set_label("Ok") okButton.set_internal_alignment("c") self.add(okButton) - + end #

@@ -117,7 +117,7 @@ initially (message) } else { if *message = 0 then - message := ["This frame unintentionally","left blank."] + message := ["This frame unintentionally","left blank."] mesg := message } end diff --git a/uni/gui/panel.icn b/uni/gui/panel.icn index fe351941d..9133e2024 100644 --- a/uni/gui/panel.icn +++ b/uni/gui/panel.icn @@ -22,11 +22,11 @@ class Panel : Component() self.do_shading(self.cbwin) if /buffer_flag then CopyArea(self.cbwin, self.cwin, self.x, self.y, self.w, self.h, self.x, self.y) - } + } else{ every (!self.children).display() self.do_shading(self.cwin) - } + } end diff --git a/uni/gui/printdlg.icn b/uni/gui/printdlg.icn index f8e827a35..2177a33ab 100644 --- a/uni/gui/printdlg.icn +++ b/uni/gui/printdlg.icn @@ -18,9 +18,9 @@ end # stddlg dialogs. # class pdialog : Dialog(printerInfo_tab_item, printer_tabset, - lprlocation_col, lprname_col, lprstatus_col, - cancel_btn, print_btn, printer_tbl, - copies_lbl, copies_txt, copies_lbl_1, printcmd) + lprlocation_col, lprname_col, lprstatus_col, + cancel_btn, print_btn, printer_tbl, + copies_lbl, copies_txt, copies_lbl_1, printcmd) method component_setup() self.setup() end @@ -37,7 +37,7 @@ class pdialog : Dialog(printerInfo_tab_item, printer_tabset, printers_lst := [], name, loc, status, ln, prn, i, log1 printers_tbl := [] -$ifdef _UNIX +$ifdef _UNIX system("lpstat -v > prn1.txt") system("lpstat -p > prn2.txt") if log1 := open("prn1.txt", "r") then { @@ -47,14 +47,14 @@ $ifdef _UNIX move(2) loc := tab(0) } - else stop("death by prn: ", image(prn)) + else stop("death by prn: ", image(prn)) } name := name[12:0] put(name_lst, name) put(loc_lst, loc) } close(log1) - remove("prn1.txt") + remove("prn1.txt") } if log1 := open("prn2.txt", "r") then { while prn := read(log1) do { @@ -62,16 +62,16 @@ $ifdef _UNIX \(ln := tab(find("."))) ln ? { tab(find("is")+2) - status := tab(0) + status := tab(0) } - } + } put(stat_lst, status) } close(log1) - remove("prn2.txt") - } + remove("prn2.txt") + } every i := 1 to * name_lst do { - printers_lst := [name_lst[i], loc_lst[i], stat_lst[i]] + printers_lst := [name_lst[i], loc_lst[i], stat_lst[i]] put(printers_tbl, printers_lst) } printer_tbl.set_contents(printers_tbl) @@ -79,7 +79,7 @@ $ifdef _UNIX $else printer_tbl.set_contents([["Printing not enabled"], [""], [""]]) $endif - + $ifdef _MS_WINDOWS_NT printcmd.set_contents("print") $else diff --git a/uni/gui/scrollarea.icn b/uni/gui/scrollarea.icn index 99b1c7d1f..8519e66e9 100644 --- a/uni/gui/scrollarea.icn +++ b/uni/gui/scrollarea.icn @@ -20,7 +20,7 @@ $include "guih.icn" # requirement for the subclass. # class ScrollArea : Component( - hsb, # + hsb, # vsb, view, last_refresh_x, @@ -67,7 +67,7 @@ class ScrollArea : Component( # For a scrollarea with a border, return the number of pixels # between the left of the component and the view component. # - # Different subclasses may override this; by default it returns + # Different subclasses may override this; by default it returns # DEFAULT_SP_X_PADDING. # method get_view_x_padding() @@ -78,7 +78,7 @@ class ScrollArea : Component( # For a scrollarea with a border, return the number of pixels # between the top of the component and the view component. # - # Different subclasses may override this; by default it returns + # Different subclasses may override this; by default it returns # DEFAULT_SP_Y_PADDING. # method get_view_y_padding() @@ -91,7 +91,7 @@ class ScrollArea : Component( # @p method set_internal_fields() local line_count, subject_width, subject_height, - max_th, max_tw, min_th, min_tw, need_vsb, need_hsb, + max_th, max_tw, min_th, min_tw, need_vsb, need_hsb, new_vsb, new_hsb # @@ -105,7 +105,7 @@ class ScrollArea : Component( view.set_pos(0, 0) max_th := self.h max_tw := self.w - } + } # # Compute maximum width @@ -224,7 +224,7 @@ class ScrollArea : Component( # Initialize scroll bars. # if \self.vsb then { - reset_height() + reset_height() if view.h > 0 then self.vsb.set_page_size(view.h) @@ -241,7 +241,7 @@ class ScrollArea : Component( self.vsb.firstly() } else self.vsb.resize() - } + } if \self.hsb then { if view.w > 0 then diff --git a/uni/gui/selectablescrollarea.icn b/uni/gui/selectablescrollarea.icn index f529bb02e..f402fd1c3 100644 --- a/uni/gui/selectablescrollarea.icn +++ b/uni/gui/selectablescrollarea.icn @@ -16,11 +16,11 @@ $include "guih.icn" # event handling and selection handling. # class SelectableScrollArea : LineBasedScrollArea( - contents, # - checked, # - select_one, # - select_many, # - cursor, + contents, # + checked, # + select_one, # + select_many, # + cursor, old_cursor, selchange, going_up, @@ -329,7 +329,7 @@ class SelectableScrollArea : LineBasedScrollArea( every i := 1 to *l do { insert(self.contents, i + n - 1, l[i]) insert(self.checked, i + n - 1) - } + } } compute_and_invalidate() end @@ -458,7 +458,7 @@ class SelectableScrollArea : LineBasedScrollArea( local i start_handle(e) if i := (\self.hsb).get_value() then { - self.hsb.set_value(i - self.hsb.increment_size) + self.hsb.set_value(i - self.hsb.increment_size) self.refresh() } end_handle(e) @@ -468,7 +468,7 @@ class SelectableScrollArea : LineBasedScrollArea( local i start_handle(e) if i := (\self.hsb).get_value() then { - self.hsb.set_value(i + self.hsb.increment_size) + self.hsb.set_value(i + self.hsb.increment_size) self.refresh() } end_handle(e) @@ -507,7 +507,7 @@ class SelectableScrollArea : LineBasedScrollArea( if self.cursor ~= l then { self.cursor := l self.refresh(1) - } + } } end_handle(e) end @@ -552,7 +552,7 @@ class SelectableScrollArea : LineBasedScrollArea( (\self.vsb).set_value(self.vsb.get_value() - self.vsb.increment_size) } else { self.cursor := self.get_last_line() + 1 - self.cursor >:= *self.contents + self.cursor >:= *self.contents (\self.vsb).set_value(self.vsb.get_value() + self.vsb.increment_size) } self.refresh(1) @@ -573,8 +573,8 @@ class SelectableScrollArea : LineBasedScrollArea( # Clear flag, refresh, return event # if (e === (&lrelease|&rrelease|&mrelease)) & - (\self.select_one | \self.select_many) & - (get_line_under_pointer() = self.cursor) then { + (\self.select_one | \self.select_many) & + (get_line_under_pointer() = self.cursor) then { l := get_selections() if \self.select_many & (&shift | &control) then { @@ -593,15 +593,15 @@ class SelectableScrollArea : LineBasedScrollArea( self.checked[self.cursor] := 1 } } - else { + else { self.checked := list(*self.contents) self.checked[\self.cursor] := 1 } self.refresh(1) if not lang::equals(get_selections(), l) then selchange := 1 - } - } + } + } end_handle(e) end @@ -736,7 +736,7 @@ class SelectableScrollArea : LineBasedScrollArea( end # - # This method is overridden by the subclass to draw the given + # This method is overridden by the subclass to draw the given # line at the given position # @param xp The left position it should be drawn at # @param yp The y position it should be drawn at diff --git a/uni/gui/stddlg.icn b/uni/gui/stddlg.icn index 4d18ed0d2..98117b6ef 100644 --- a/uni/gui/stddlg.icn +++ b/uni/gui/stddlg.icn @@ -11,14 +11,14 @@ package gui global dialog_value, dialog_button -$define ButtonWidth 50 # minimum button width -$define ButtonHeight 30 # button height -$define FieldWidth 20 # default field width -$define OpenWidth 50 # default field width for Open/SaveDialog +$define ButtonWidth 50 # minimum button width +$define ButtonHeight 30 # button height +$define FieldWidth 20 # default field width +$define OpenWidth 50 # default field width for Open/SaveDialog -$define XOff 0 # offset for text vidgets -$define XOffButton 85 # initial x offset for buttons -$define XOffIncr 15 # space between buttons +$define XOff 0 # offset for text vidgets +$define XOffButton 85 # initial x offset for buttons +$define XOffIncr 15 # space between buttons # dialog used for selection, dialog_value should be one of choices, or &null class sdialog : Dialog(captions, choices, dflt, buttons, index, choice_width) @@ -40,12 +40,12 @@ class sdialog : Dialog(captions, choices, dflt, buttons, index, choice_width) self.set_attribs("size="||(220+choice_width)||"," || (32 * nlines)) every i := 1 to *captions do { - cap := Label() - cap.set_pos("20", integer(i *100 / nlines)|| "%-5") - cap.set_internal_alignment("l") - cap.set_label(captions[i]) - self.add(cap) - } + cap := Label() + cap.set_pos("20", integer(i *100 / nlines)|| "%-5") + cap.set_internal_alignment("l") + cap.set_label(captions[i]) + self.add(cap) + } border_1 := Border() border_1.set_pos("10", integer((i+1) * 100 / nlines) || "%-5") border_1.set_size("100%-20",((*choices)*100/nlines)||"%") @@ -53,27 +53,27 @@ class sdialog : Dialog(captions, choices, dflt, buttons, index, choice_width) check_box_group_1 := CheckBoxGroup() every i := 1 to *choices do { - cb := CheckBox() - cb.set_pos(10, integer(i*100/nlines) || "%") - cb.set_toggles() - check_box_group_1.add(cb) - cb.set_label(choices[i]) - cb.connect(self, "on_selection", ACTION_EVENT) - border_1.add(cb) - } + cb := CheckBox() + cb.set_pos(10, integer(i*100/nlines) || "%") + cb.set_toggles() + check_box_group_1.add(cb) + cb.set_label(choices[i]) + cb.connect(self, "on_selection", ACTION_EVENT) + border_1.add(cb) + } self.add(border_1) every i := 1 to *buttons do { - text_button_1 := TextButton() - text_button_1.set_pos( integer(i * 100 / (*buttons+1)) || "%-20", - integer((*captions + *choices + 1)*100/nlines) || - "%" ) - text_button_1.connect(self, "on_button", ACTION_EVENT) - text_button_1.clear_toggles() - text_button_1.set_label(buttons[i]) - text_button_1.set_internal_alignment("c") - self.add(text_button_1) - } + text_button_1 := TextButton() + text_button_1.set_pos( integer(i * 100 / (*buttons+1)) || "%-20", + integer((*captions + *choices + 1)*100/nlines) || + "%" ) + text_button_1.connect(self, "on_button", ACTION_EVENT) + text_button_1.clear_toggles() + text_button_1.set_label(buttons[i]) + text_button_1.set_internal_alignment("c") + self.add(text_button_1) + } end method on_selection(ev) @@ -91,7 +91,7 @@ class sdialog : Dialog(captions, choices, dflt, buttons, index, choice_width) if ev.param === -12 then fail # do not trigger on mouse moves dialog_button := buttons[1] if ev.param === "\r" then - dispose() + dispose() end initially(caps, chocs, dflt, btns, indx, chow) @@ -125,7 +125,7 @@ local default_width, default_button, maxl, id, choice_width, maxb, lead, pad, if type(choices) ~== "list" then choices := ([\choices] | []) if type(buttons) ~== "list" then buttons := [buttons] - default_button := buttons[index] # null if out of bounds + default_button := buttons[index] # null if out of bounds default_width := FieldWidth maxl := 0 @@ -161,7 +161,7 @@ end # toggle dialog. myanswer should be a 1 for Okay or &null for cancel. class tdialog : Dialog(captions, toggles, states, buttons, index, tognam_width, - myanswer, cboxes) + myanswer, cboxes) method component_setup() self.setup() end @@ -182,34 +182,34 @@ cboxes := [] self.set_attribs("size="||(220+tognam_width)||"," || (32 * nlines)) every i := 1 to *captions do { - cap := Label() - cap.set_pos("20", integer(i *100 / nlines)|| "%-5") - cap.set_internal_alignment("l") - cap.set_label(captions[i]) - self.add(cap) - } + cap := Label() + cap.set_pos("20", integer(i *100 / nlines)|| "%-5") + cap.set_internal_alignment("l") + cap.set_label(captions[i]) + self.add(cap) + } every i := 1 to *toggles do { - cb := CheckBox() - cb.set_pos(10, integer((*captions+i)*100/nlines) || "%") - cb.set_toggles() - if \ (states[i]) then cb.set_is_checked() - cb.set_label(toggles[i]) - self.add(cb) - put(cboxes, cb) - } + cb := CheckBox() + cb.set_pos(10, integer((*captions+i)*100/nlines) || "%") + cb.set_toggles() + if \ (states[i]) then cb.set_is_checked() + cb.set_label(toggles[i]) + self.add(cb) + put(cboxes, cb) + } every i := 1 to *buttons do { - text_button_1 := TextButton() - text_button_1.set_pos( integer(i * 100 / (*buttons+1)) || "%-20", - integer((*captions + *toggles + 1)*100/nlines) || - "%" ) - text_button_1.connect(self, "on_button", ACTION_EVENT) - text_button_1.clear_toggles() - text_button_1.set_label(buttons[i]) - text_button_1.set_internal_alignment("c") - self.add(text_button_1) - } + text_button_1 := TextButton() + text_button_1.set_pos( integer(i * 100 / (*buttons+1)) || "%-20", + integer((*captions + *toggles + 1)*100/nlines) || + "%" ) + text_button_1.connect(self, "on_button", ACTION_EVENT) + text_button_1.clear_toggles() + text_button_1.set_label(buttons[i]) + text_button_1.set_internal_alignment("c") + self.add(text_button_1) + } end method on_button(ev) @@ -222,7 +222,7 @@ cboxes := [] if ev.param === -12 then fail # do not trigger on mouse moves myanswer := buttons[1] if ev.param === "\r" then - dispose() + dispose() end initially(caps, togs, stats, btns, indx, togw) @@ -258,7 +258,7 @@ local default_width, default_button, maxl, id, tognam_width, maxb, lead, pad, if type(states) ~== "list" then states := ([\states] | []) if type(buttons) ~== "list" then buttons := [buttons] - default_button := buttons[index] # null if out of bounds + default_button := buttons[index] # null if out of bounds default_width := FieldWidth maxl := 0 @@ -297,8 +297,8 @@ local default_width, default_button, maxl, id, tognam_width, maxb, lead, pad, end class vdialog : Dialog(captions, labels, buttons, textfields, - defaults, myanswer, label_width, - myanswer) + defaults, myanswer, label_width, + myanswer) method component_setup() self.setup() end @@ -314,8 +314,8 @@ class vdialog : Dialog(captions, labels, buttons, textfields, maxw <:= 220+label_width self.resize_win(maxw, (32 * (*captions + *labels +2))) if textfields[1] then { - Enqueue(\win, &lpress, textfields[1].x+2, textfields[1].y+2) - } + Enqueue(\win, &lpress, textfields[1].x+2, textfields[1].y+2) + } end method setup() @@ -325,51 +325,51 @@ class vdialog : Dialog(captions, labels, buttons, textfields, self.set_attribs("size="||(220+label_width)||"," || (32 * nlines)) every i := 1 to *captions do { - cap := Label() - cap.set_pos("20", integer(i *100 / nlines)|| "%-5") - cap.set_internal_alignment("l") - cap.set_label(captions[i]) - self.add(cap) - } + cap := Label() + cap.set_pos("20", integer(i *100 / nlines)|| "%-5") + cap.set_internal_alignment("l") + cap.set_label(captions[i]) + self.add(cap) + } every i := 1 to *labels do { - label_2 := Label() - label_2.set_pos(20, integer((*captions + i)*100/nlines) || "%") - label_2.set_internal_alignment("l") - label_2.set_label(labels[i]) - self.add(label_2) - } + label_2 := Label() + label_2.set_pos(20, integer((*captions + i)*100/nlines) || "%") + label_2.set_internal_alignment("l") + label_2.set_label(labels[i]) + self.add(label_2) + } every i := 1 to *labels do { - text_field_1 := TextField() - text_field_1.set_pos(20+label_width, - integer((*captions + i)*100/nlines) || "%-10") - text_field_1.set_size(180, 30) - text_field_1.set_contents((\defaults)[i]) - text_field_1.set_draw_border() + text_field_1 := TextField() + text_field_1.set_pos(20+label_width, + integer((*captions + i)*100/nlines) || "%-10") + text_field_1.set_size(180, 30) + text_field_1.set_contents((\defaults)[i]) + text_field_1.set_draw_border() if \dialogFor == "find" then - text_field_1.set_contents(findstr) + text_field_1.set_contents(findstr) else if \dialogFor == "goto" then - text_field_1.set_contents(gotoln) + text_field_1.set_contents(gotoln) else if \dialogFor == "compile" then - text_field_1.set_contents(targs) + text_field_1.set_contents(targs) else if \dialogFor == "run" then - text_field_1.set_contents(xargs) + text_field_1.set_contents(xargs) else text_field_1.set_contents("") - text_field_1.connect(self, "on_keypress", ACTION_EVENT) + text_field_1.connect(self, "on_keypress", ACTION_EVENT) - self.add(text_field_1) - put(textfields, text_field_1) - } + self.add(text_field_1) + put(textfields, text_field_1) + } every i := 1 to *buttons do { - text_button_1 := TextButton() - text_button_1.set_pos( integer(i * 100 / (*buttons+1)) || "%-20", - integer((*captions + *labels + 1)*100/nlines) || - "%" ) - text_button_1.connect(self, "on_button", ACTION_EVENT) - text_button_1.clear_toggles() - text_button_1.set_label(buttons[i]) - text_button_1.set_internal_alignment("c") - self.add(text_button_1) - } + text_button_1 := TextButton() + text_button_1.set_pos( integer(i * 100 / (*buttons+1)) || "%-20", + integer((*captions + *labels + 1)*100/nlines) || + "%" ) + text_button_1.connect(self, "on_button", ACTION_EVENT) + text_button_1.clear_toggles() + text_button_1.set_label(buttons[i]) + text_button_1.set_internal_alignment("c") + self.add(text_button_1) + } end method on_button(ev) @@ -382,7 +382,7 @@ class vdialog : Dialog(captions, labels, buttons, textfields, if ev.param === -12 then fail # do not trigger on mouse moves myanswer := buttons[1] if ev.param === "\r" then - dispose() + dispose() end initially(caps, labs, btns, dflts, labwid) @@ -396,7 +396,7 @@ initially(caps, labs, btns, dflts, labwid) end -procedure TextDialog( #: text dialog +procedure TextDialog( #: text dialog win, captions, labels, defaults, widths, buttons, index ) local default_width, default_button, maxl, id, label_width, maxb, lead, pad, @@ -422,7 +422,7 @@ local default_width, default_button, maxl, id, label_width, maxb, lead, pad, if type(widths) ~== "list" then widths := ([\widths] | [default_width]) if type(buttons) ~== "list" then buttons := [buttons] - default_button := buttons[index] # null if out of bounds + default_button := buttons[index] # null if out of bounds default_width := widths[-1] | FieldWidth maxl := 0 @@ -460,11 +460,11 @@ local default_width, default_button, maxl, id, label_width, maxb, lead, pad, return dialog_button end -procedure Notice(captions[]) #: notice dialog +procedure Notice(captions[]) #: notice dialog local win, temp_win, p static type - initial type := proc("type", 0) # protect attractive name + initial type := proc("type", 0) # protect attractive name if type(captions[1]) == "window" then win := get(captions) @@ -510,12 +510,12 @@ class ColourRectangle : Component(r, g, b) method set_hsv(h, s, v) dialog_value := HSVValue(h||"/"||s||"/"||v) | stop("no HSVValue") dialog_value ? { - self.r := integer(tab(many(&digits))) - ="," - self.g := integer(tab(many(&digits))) - ="," - self.b := integer(tab(many(&digits))) - } + self.r := integer(tab(many(&digits))) + ="," + self.g := integer(tab(many(&digits))) + ="," + self.b := integer(tab(many(&digits))) + } end initially @@ -523,8 +523,8 @@ class ColourRectangle : Component(r, g, b) end class cdialog : Dialog(captions, refcolor, callback, value, - s1, s2, s3, s4, s5, s6, # RBG, then HSV - b1, cr, lab, myanswer) + s1, s2, s3, s4, s5, s6, # RBG, then HSV + b1, cr, lab, myanswer) method init_dialog() local maxw := 0 every maxw <:= TextWidth(win, !captions) @@ -555,16 +555,16 @@ if ev.source === (s1 | s2 | s3) then { # set s4, s5, s6 hsv := HSV(r||","||g||","||b) hsv ? { - h := tab(many(&digits)) - ="/" - s := tab(many(&digits)) - ="/" - v := tab(many(&digits)) - s4.set_value(h) - s5.set_value(s) - s6.set_value(v) - invalidate() - } + h := tab(many(&digits)) + ="/" + s := tab(many(&digits)) + ="/" + v := tab(many(&digits)) + s4.set_value(h) + s5.set_value(s) + s6.set_value(v) + invalidate() + } } else if ev.source === (s4 | s5 | s6) then { cr.set_hsv((h:=s4.get_value()), (s:=s5.get_value()), (v:=s6.get_value())) @@ -572,16 +572,16 @@ else if ev.source === (s4 | s5 | s6) then { # set s1, s2, s3 rgb := HSVValue(h||"/"||s||"/"||v) rgb ? { - r := tab(many(&digits)) - ="," - g := tab(many(&digits)) - ="," - b := tab(many(&digits)) - s1.set_value(r) - s2.set_value(g) - s3.set_value(b) - invalidate() - } + r := tab(many(&digits)) + ="," + g := tab(many(&digits)) + ="," + b := tab(many(&digits)) + s1.set_value(r) + s2.set_value(g) + s3.set_value(b) + invalidate() + } } lab.set_label("(" || s1.get_value() || ", " || s2.get_value() || ", " || s3.get_value() || ")") end @@ -594,15 +594,15 @@ else if ev.source === (s4 | s5 | s6) then { self.set_attribs_list(["size=420,370"]) every i := 1 to *captions do { - cap := Label() - cap.set_pos("20", string(i * 32)) - cap.set_internal_alignment("l") - cap.set_label(captions[i]) - self.add(cap) - } + cap := Label() + cap.set_pos("20", string(i * 32)) + cap.set_internal_alignment("l") + cap.set_label(captions[i]) + self.add(cap) + } s1 := Slider() - s1.set_pos("40", "50%") + s1.set_pos("40", "50%") s1.set_align("c", "c") s1.set_size(, "50%") s1.set_range(0, 65535) @@ -611,9 +611,9 @@ else if ev.source === (s4 | s5 | s6) then { s1.set_value(0) s1.connect(self, "on_slider") self.add(s1) - + s2 := Slider() - s2.set_pos("80", "50%") + s2.set_pos("80", "50%") s2.set_align("c", "c") s2.set_size(, "50%") s2.set_range(0, 65535) @@ -622,9 +622,9 @@ else if ev.source === (s4 | s5 | s6) then { s2.set_value(0) s2.connect(self, "on_slider") self.add(s2) - + s3 := Slider() - s3.set_pos("120", "50%") + s3.set_pos("120", "50%") s3.set_align("c", "c") s3.set_size(, "50%") s3.set_range(0, 65535) @@ -635,7 +635,7 @@ else if ev.source === (s4 | s5 | s6) then { self.add(s3) s4 := Slider() - s4.set_pos("300", "50%") + s4.set_pos("300", "50%") s4.set_align("c", "c") s4.set_size(, "50%") s4.set_range(0, 360) @@ -644,9 +644,9 @@ else if ev.source === (s4 | s5 | s6) then { s4.set_value(0) s4.connect(self, "on_slider") self.add(s4) - + s5 := Slider() - s5.set_pos("340", "50%") + s5.set_pos("340", "50%") s5.set_align("c", "c") s5.set_size(, "50%") s5.set_range(0, 100) @@ -655,9 +655,9 @@ else if ev.source === (s4 | s5 | s6) then { s5.set_value(0) s5.connect(self, "on_slider") self.add(s5) - + s6 := Slider() - s6.set_pos("380", "50%") + s6.set_pos("380", "50%") s6.set_align("c", "c") s6.set_size(, "50%") s6.set_range(0, 100) @@ -668,9 +668,9 @@ else if ev.source === (s4 | s5 | s6) then { self.add(s6) cr := ColourRectangle() - cr.set_pos("200", "50%") + cr.set_pos("200", "50%") cr.set_align("c", "c") - cr.set_size(70, 70) + cr.set_size(70, 70) cr.set_colours(0, 0, 0) self.add(cr) @@ -681,7 +681,7 @@ else if ev.source === (s4 | s5 | s6) then { lab.set_pos(200, "50%-90") lab.set_align("c", "c") self.add(lab) - + b1 := TextButton() b1.set_label("Okay") b1.set_pos("35%", "88%") diff --git a/uni/gui/textbutton.icn b/uni/gui/textbutton.icn index 166b5d337..0eeb14c40 100644 --- a/uni/gui/textbutton.icn +++ b/uni/gui/textbutton.icn @@ -18,8 +18,8 @@ $include "guih.icn" # be left to default to a size based on the given label. # class TextButton : Button( - internal_alignment, # - tx, # + internal_alignment, # + tx, # tw # ) @@ -40,17 +40,17 @@ class TextButton : Button( if /self.transparent then{ EraseRectangle(self.cbwin, self.x, self.y, self.w, self.h) - dwin := self.cbwin - } + dwin := self.cbwin + } else - dwin := self.cwin + dwin := self.cwin case self.internal_alignment of { "c" : center_string(dwin, self.tx + self.tw / 2, yoff, self.label, self.accel) "l" : left_string(dwin, self.tx, yoff, self.label, self.accel) "r" : right_string(dwin, self.tx + self.tw, yoff, self.label, self.accel) default : fatal("incorrect internal_alignment specifier: " || image(self.internal_alignment)) - } + } if /self.no_keyboard_flag & \self.has_focus then { DashedRectangle(dwin, self.x + BORDER_WIDTH + 1, self.y + BORDER_WIDTH + 1, self.w - 2 * BORDER_WIDTH - 2, self.h - 2 * BORDER_WIDTH - 2) @@ -86,7 +86,7 @@ class TextButton : Button( self.tx := self.x + DEFAULT_TEXT_X_SURROUND self.tw := self.w - 2 * DEFAULT_TEXT_X_SURROUND end - + method set_one(attr, val) case attr of { "internal_alignment" : set_internal_alignment(string_val(attr, val)) diff --git a/uni/gui/textfield.icn b/uni/gui/textfield.icn index 41c033f02..6bfb056fe 100644 --- a/uni/gui/textfield.icn +++ b/uni/gui/textfield.icn @@ -544,7 +544,7 @@ class TextField : Component( # Clear rectangle, set s to string to display # EraseRectangle(dwin, self.x, self.y, self.w, self.h) - } + } else{ dwin := self.cwin } @@ -566,7 +566,7 @@ class TextField : Component( mp := cp + 1 } else { np := cp - np >:= (*view_str + 1) + np >:= (*view_str + 1) } if mark > cursor then @@ -574,28 +574,28 @@ class TextField : Component( else mp2 := mp - if (off1 := TextWidth(self.cwin, view_str[1:mp2 ])) & - (off2 := TextWidth(self.cwin, view_str[1:np])) then { + if (off1 := TextWidth(self.cwin, view_str[1:mp2 ])) & + (off2 := TextWidth(self.cwin, view_str[1:np])) then { - left_string(dwin, self.tx, self.y + self.h / 2 , view_str[1:mp]) + left_string(dwin, self.tx, self.y + self.h / 2 , view_str[1:mp]) - cw := Clone(dwin, "fg=blue") - FillRectangle(cw, self.tx + off1, + cw := Clone(dwin, "fg=blue") + FillRectangle(cw, self.tx + off1, 1 + self.y + (self.h - fh) / 2, off2 - off1, fh) - WAttrib(cw, "fg=white") - left_string(cw, self.tx+off1, self.y + self.h / 2 , view_str[mp2:np]) - Uncouple(cw) + WAttrib(cw, "fg=white") + left_string(cw, self.tx+off1, self.y + self.h / 2 , view_str[mp2:np]) + Uncouple(cw) - left_string(dwin, self.tx+off2, self.y + self.h / 2 , view_str[np:0]) - nocursor := 1 + left_string(dwin, self.tx+off2, self.y + self.h / 2 , view_str[np:0]) + nocursor := 1 } } else{ - # - # Display view_str centred vertically in box + # + # Display view_str centred vertically in box # left_string(dwin, self.tx, self.y + self.h / 2 , view_str) diff --git a/uni/gui/yesnodialog.icn b/uni/gui/yesnodialog.icn index a9995dee3..da28aa3f9 100644 --- a/uni/gui/yesnodialog.icn +++ b/uni/gui/yesnodialog.icn @@ -155,9 +155,9 @@ class YesNoDialog : Dialog(yesButton, noButton, messageArea, mesg, mFont, minAre /message := "Yes or No?" if type(message) == "string" then { mesg := stringToList(message) - } + } else { if *message = 0 then message := ["Yes or No?"] mesg := message - } + } end From 46775137abfd4251283aeb200d4ecbde0b71aa90 Mon Sep 17 00:00:00 2001 From: Don Ward Date: Sun, 10 Mar 2024 12:37:07 +0000 Subject: [PATCH 3/7] Convert tabs to spaces (uni/ide). --- uni/ide/buffertabitem.icn | 46 +- uni/ide/buffertabset.icn | 4 +- uni/ide/buffertextlist.icn | 396 ++++++++-------- uni/ide/classbrowser.icn | 220 ++++----- uni/ide/configopt.icn | 6 +- uni/ide/funclookup.icn | 400 ++++++++-------- uni/ide/hfiledialog.icn | 54 +-- uni/ide/ide.icn | 844 ++++++++++++++++----------------- uni/ide/ivib/attribtab.icn | 38 +- uni/ide/ivib/canvas.icn | 182 +++---- uni/ide/ivib/code.icn | 48 +- uni/ide/ivib/icon/xpmtoims.icn | 12 +- uni/ide/ivib/main.icn | 96 ++-- uni/ide/ivib/version.icn | 24 +- uni/ide/mainbar.icn | 566 +++++++++++----------- uni/ide/matchparen.icn | 18 +- uni/ide/modified.icn | 18 +- uni/ide/online.icn | 14 +- uni/ide/preferences.icn | 80 ++-- uni/ide/ptyDispatcher.icn | 24 +- uni/ide/qu_replace.icn | 26 +- uni/ide/shelletl.icn | 194 ++++---- uni/ide/ui.icn | 124 ++--- uni/ide/uproject.icn | 44 +- uni/ide/utags.icn | 76 +-- uni/ide/verifymake.icn | 12 +- uni/ide/wu.icn | 822 ++++++++++++++++---------------- 27 files changed, 2194 insertions(+), 2194 deletions(-) diff --git a/uni/ide/buffertabitem.icn b/uni/ide/buffertabitem.icn index 2e0d1f122..db74eabe5 100644 --- a/uni/ide/buffertabitem.icn +++ b/uni/ide/buffertabitem.icn @@ -1,12 +1,12 @@ ################################################################ # -# File: buffertabitem.icn +# File: buffertabitem.icn # -# Subject: SubClass TabItem +# Subject: SubClass TabItem # -# Author: Nolan Clayton +# Author: Nolan Clayton # -# Date: May 26, 2004 +# Date: May 26, 2004 # ################################################################ @@ -14,19 +14,19 @@ $include "guih.icn" import gui # -# class BufferTabItem: Overide Display method and add an extra attribute. +# class BufferTabItem: Overide Display method and add an extra attribute. # class BufferTabItem : TabItem ( filename, # The Complete filename of the TabItem (c:\Unicon ....). filedirectory # Absolute Path to file ) - + method setfilename(x) set_label(if \x then file_name (x) else " ") return filename := x end - + method get_label() return label end @@ -34,7 +34,7 @@ class BufferTabItem : TabItem ( method set_label(x) return label := x end - + method getfilename() return filename end @@ -44,21 +44,21 @@ class BufferTabItem : TabItem ( # method display_tab() local xpw, pslh, updown, ypos, cw - + ypos := (line_no - 1) * parent.line_h + parent.y cw := Clone(parent.cbwin) xpw := label_x + label_w pslh := parent.line_h - + Fg(cw, "black") #"greyish white") DrawLine(cw, xpw - 1, ypos, xpw - 1, ypos + pslh - 1) DrawLine(cw, xpw - 2, ypos + 1, xpw - 2, ypos + pslh - 2) DrawLine(cw, label_x, ypos + pslh - 1, label_x, ypos, xpw - 1, ypos) - + Fg(cw, "white") DrawLine(cw, label_x + 1, ypos + pslh - 2, - label_x + 1, ypos + 1, xpw - 2, ypos + 1) + label_x + 1, ypos + 1, xpw - 2, ypos + 1) Uncouple(cw) # @@ -66,28 +66,28 @@ class BufferTabItem : TabItem ( # Fg(\ (parent.cbwin), "white") FillRectangle(parent.cbwin, label_x, ypos + 2 + (pslh - 2) / 2, - label_w - 2, (pslh - 2) / 2) + label_w - 2, (pslh - 2) / 2) Fg(\ (parent.cbwin), "pale greyish white") FillRectangle(parent.cbwin, label_x, ypos + 2 + (pslh - 2) / 2, - label_w - 2, (pslh - 2) / 4) + label_w - 2, (pslh - 2) / 4) Fg(\ (parent.cbwin), "light greyish white") FillRectangle(parent.cbwin, label_x, ypos + 2, - label_w - 2, (pslh - 2) /2 ) + label_w - 2, (pslh - 2) /2 ) Fg(\ (parent.cbwin), "greyish white") FillRectangle(parent.cbwin, label_x, ypos + 2, - label_w - 2, (pslh - 2) / 4) + label_w - 2, (pslh - 2) / 4) updown := -1 if parent.which_one === self then updown := 1 Fg(\ (parent.cbwin), "pale grey") BevelRoundedRectangle(parent.cbwin, label_x + DEFAULT_TEXT_X_SURROUND -1, - ypos-6 + pslh / 2, TextWidth(parent.cbwin, label), - 3 + (pslh - 2) / 2, updown) + ypos-6 + pslh / 2, TextWidth(parent.cbwin, label), + 3 + (pslh - 2) / 2, updown) Fg(\ (parent.cbwin), "black") left_string(parent.cbwin, label_x + DEFAULT_TEXT_X_SURROUND, - ypos + pslh / 2, label) + ypos + pslh / 2, label) if is_shaded() then FilterRectangle(parent.cbwin, label_x, ypos + 2, label_w - 2, pslh-1) @@ -102,18 +102,18 @@ end # Bevel Rounded Rectangle Proc: Draw a Beveled Rounded Rectangle # to be used for a TabItem. # -procedure BevelRoundedRectangle(win, x, y, w, h, bw) - local b, upper, lower, xx, yy, r, a, cx, cy, cw, cr, oldfg1, oldfg2 +procedure BevelRoundedRectangle(win, x, y, w, h, bw) + local b, upper, lower, xx, yy, r, a, cx, cy, cw, cr, oldfg1, oldfg2 static type - initial type := proc("type", 0) # protect attractive name + initial type := proc("type", 0) # protect attractive name if bw >= 0 then { FillRectangle(win,x, y, w, h) FillCircle(win,x, y + (h/2), h/2 -1) FillCircle(win,x +w , y + (h/2), h/2 -1) } - + if type(win) ~== "window" then return BevelRectangle((\&window | runerr(140)), win, x, y, w, h) b := bev_lookup(win) diff --git a/uni/ide/buffertabset.icn b/uni/ide/buffertabset.icn index 595c65a85..4d369d06d 100644 --- a/uni/ide/buffertabset.icn +++ b/uni/ide/buffertabset.icn @@ -31,14 +31,14 @@ class BufferTabSet : TabSet() if /last_on_a_line then DrawLine(cw, which_one.label_x + which_one.label_w, y + tab_h - 2, - x + w - 1, y + tab_h - 2) + x + w - 1, y + tab_h - 2) Fg(cw, "black") DrawLine(cw, x, y + tab_h - 1, which_one.label_x, y + tab_h - 1) if /last_on_a_line then DrawLine(cw, which_one.label_x + which_one.label_w, y + tab_h - 1, - x + w - 2, y + tab_h - 1) + x + w - 2, y + tab_h - 1) Uncouple(cw) diff --git a/uni/ide/buffertextlist.icn b/uni/ide/buffertextlist.icn index d6db01e6d..f3c9bae0f 100644 --- a/uni/ide/buffertextlist.icn +++ b/uni/ide/buffertextlist.icn @@ -32,12 +32,12 @@ class IDEKeybindings : Keybindings(mode, prefix) local m if type(e) == "string" then e := prefix || e if m := \ (keymap[e]) then { - if m == "handle_prefix" then prefix ||:= e - else { - prefix := "" - return m - } - } + if m == "handle_prefix" then prefix ||:= e + else { + prefix := "" + return m + } + } end method current_mode() return mode @@ -55,41 +55,41 @@ class IDEKeybindings : Keybindings(mode, prefix) method emacs_mode() mode := "emacs" set_key("\e", "handle_prefix", - Key_Home, "ide_key_home", - Key_End, "ide_key_end", - "\^a", "handle_start_of_line", - "\^b", "backward_char", - "\^c", "handle_prefix", - "\^f", "forward_char", - "\^n", "handle_key_down", - "\^p", "handle_key_up", - "\^v", "handle_key_page_down", - "\^x", "handle_prefix", - "\^y", "handle_paste", - "\^z", "handle_scrolldown_one_line", - "\^x\^c", "handle_exit", - "\^x\^x", "exchange_point_and_mark", - "\^x\^f", "find_file", - "\^x\^s", "save_buffer", - "\^x\^n", "next_error" + Key_Home, "ide_key_home", + Key_End, "ide_key_end", + "\^a", "handle_start_of_line", + "\^b", "backward_char", + "\^c", "handle_prefix", + "\^f", "forward_char", + "\^n", "handle_key_down", + "\^p", "handle_key_up", + "\^v", "handle_key_page_down", + "\^x", "handle_prefix", + "\^y", "handle_paste", + "\^z", "handle_scrolldown_one_line", + "\^x\^c", "handle_exit", + "\^x\^x", "exchange_point_and_mark", + "\^x\^f", "find_file", + "\^x\^s", "save_buffer", + "\^x\^n", "next_error" # Proposed function key bindings. Still under construction. # Loosely based on Borland-style IDE keybindings. # -# Key Base Control Alt Shift -# F1 Help search@crsr help/srch help index -# F2 Save file restart Find(next) grep -# F3 Open file callstack closewin New file +# Key Base Control Alt Shift +# F1 Help search@crsr help/srch help index +# F2 Save file restart Find(next) grep +# F3 Open file callstack closewin New file # F4 Run to cursor -# F5 Toggle breakpt User screen -# F6 Next win Previous win -# F7 Step set watchpt -# F8 Next set breakpt -# F9 Make Run Compileonly Run/debug -# F10 Main menu -# F11 runtime msgs project dlg inspect -# F12 compiler msgs toggle ivib +# F5 Toggle breakpt User screen +# F6 Next win Previous win +# F7 Step set watchpt +# F8 Next set breakpt +# F9 Make Run Compileonly Run/debug +# F10 Main menu +# F11 runtime msgs project dlg inspect +# F12 compiler msgs toggle ivib # alt-x = exit - ) + ) end initially self.Keybindings.initially() @@ -97,7 +97,7 @@ initially end class BuffEditableTextList : EditableTextList( - moved, # to-do: check if we need this and if so, implement it. + moved, # to-do: check if we need this and if so, implement it. mouse_locked, scroll_locked, pm, @@ -138,41 +138,41 @@ class BuffEditableTextList : EditableTextList( local t1, t2 self$Connectable.fire(type, param) if type === CONTENT_CHANGED_EVENT then { - # Optimize this blind any-change==reparse logic to be more - # selective. Pressing return won't change the token sequence, - # nor will editing of comments. - doReparse := 1 - } + # Optimize this blind any-change==reparse logic to be more + # selective. Pressing return won't change the token sequence, + # nor will editing of comments. + doReparse := 1 + } if type === CURSOR_MOVED_EVENT & old_cursor_y ~= cursor_y then { - t1 := &time - ReparseCode() - t2 := &time - if t2 - t1 > 150 then - write(&errout, "syntax checking is slow in here (", t2-t1, - "ms); consider disabling it") - } + t1 := &time + ReparseCode() + t2 := &time + if t2 - t1 > 150 then + write(&errout, "syntax checking is slow in here (", t2-t1, + "ms); consider disabling it") + } end method on_vsb(ev,y_coor,enter_here) if /enter_here & \scroll_locked then fail #lock scrollbar self.EditableTextList.on_vsb(ev) if \enter_here=1 then { - if \self.vsb then { - self.vsb.set_value(y_coor) - enter_here := 0 - } - } + if \self.vsb then { + self.vsb.set_value(y_coor) + enter_here := 0 + } + } end method on_hsb(ev,x_coor,enter_here) if /enter_here & \scroll_locked then fail#lock scrollbar self.EditableTextList.on_hsb(ev) if \enter_here=1 then { - if \self.hsb then { - self.hsb.set_value(x_coor) - enter_here := 0 - } - } + if \self.hsb then { + self.hsb.set_value(x_coor) + enter_here := 0 + } + } end method handle_press(e,received) @@ -193,26 +193,26 @@ class BuffEditableTextList : EditableTextList( method handle_return(e) local i, str, t1, t2 self.EditableTextList.handle_return(e) - if \autoindent then{ - str := contents[cursor_y - 1] - i := 1 + if \autoindent then{ + str := contents[cursor_y - 1] + i := 1 - while i < *str + 1 do { - case str[i] of { + while i < *str + 1 do { + case str[i] of { " " : handle_default(" ") #"\t" : handle_tab_text("\t") default : i := *str +2 } i +:= 1 - } + } } # Reparse code when the cursor moves in the Y axis t1 := &time ReparseCode() t2 := &time if t2 - t1 > 150 then - write(&errout, "syntax checking is slow in here (", t2-t1, - "ms); consider disabling it") + write(&errout, "syntax checking is slow in here (", t2-t1, + "ms); consider disabling it") end @@ -222,45 +222,45 @@ class BuffEditableTextList : EditableTextList( word := known.word_under_cursor() popup_item.disconnect(\l) if word === -1 then { - #right-clicked on something besides a word - #popmenu item should be a discription of what it can do - popup_item.set_label("Method call jumps to definition") - } + #right-clicked on something besides a word + #popmenu item should be a discription of what it can do + popup_item.set_label("Method call jumps to definition") + } else { - func_type := known.func_lookup(word) - if func_type === 1 then { - #popup menu item should be documentation for (function) - popup_item.set_label("function "|| word || "()") - l := popup_item.connect(self, "open_ref", ACTION_EVENT) - } - else if func_type === 2 then { - #popup menu item should be Jump-To (name of function) - popup_item.set_label("Jump to function definition for: "|| word) - l := popup_item.connect(self, "jump_to", ACTION_EVENT) - - #popup_item.disconnect(self) - } - else if type(func_type) == "list" then { - popup_item.set_label(func_type[1] || " " || word || " " || - func_type[2]) - } - else { - #popmenu item should be a discription of what it can do - popup_item.set_label("Method call jumps to definition") - } - } + func_type := known.func_lookup(word) + if func_type === 1 then { + #popup menu item should be documentation for (function) + popup_item.set_label("function "|| word || "()") + l := popup_item.connect(self, "open_ref", ACTION_EVENT) + } + else if func_type === 2 then { + #popup menu item should be Jump-To (name of function) + popup_item.set_label("Jump to function definition for: "|| word) + l := popup_item.connect(self, "jump_to", ACTION_EVENT) + + #popup_item.disconnect(self) + } + else if type(func_type) == "list" then { + popup_item.set_label(func_type[1] || " " || word || " " || + func_type[2]) + } + else { + #popmenu item should be a discription of what it can do + popup_item.set_label("Method call jumps to definition") + } + } # Only add it once. if *pm_menu.children === 0 then { - pm_menu.add(popup_item) - pm.attrib("fg=magenta") - } + pm_menu.add(popup_item) + pm.attrib("fg=magenta") + } pm.set_menu(pm_menu) - pm.set_parent(self.parent_dialog) + pm.set_parent(self.parent_dialog) if !children === pm then {} else - add(pm) + add(pm) pm.init() - + #pm.set_pos(self.cursor_x, self.cursor_y) #pm.resize() #pm.display() @@ -284,27 +284,27 @@ class BuffEditableTextList : EditableTextList( method handle_event(e) local t1, t2 if integer(e) = &mpress then - simulate_wheelbutton() + simulate_wheelbutton() # turn scroll up/down into a key_up/down in the vsb. else if integer(e) = -13 then every 1 to 4 do (\vsb).handle_button_up(e) else if integer(e) = -14 then every 1 to 4 do (\vsb).handle_button_down(e) else if integer(e) === &rrelease then { - handle_right_click(e) - } - else self.EditableTextList.handle_event(e) + handle_right_click(e) + } + else self.EditableTextList.handle_event(e) + - if \self.old_cursor_y ~= self.cursor_y then { - t1 := &time - ReparseCode() - t2 := &time - if t2 - t1 > 150 then - write(&errout, "syntax checking is slow in here (", t2-t1, - "ms); consider disabling it") - } - + t1 := &time + ReparseCode() + t2 := &time + if t2 - t1 > 150 then + write(&errout, "syntax checking is slow in here (", t2-t1, + "ms); consider disabling it") + } + if \self.changed then { #ide.modified:=1 if not (ide.CurrentTabItem().label[-1] == "*") then { @@ -330,10 +330,10 @@ class BuffEditableTextList : EditableTextList( method cursor_update() delay(300) paren_match_found:=&null - self.cursor_y := self.old_cursor_y + self.cursor_y := self.old_cursor_y self.cursor_x := self.old_cursor_x end - + method match_paren() local paren, paren_closing, paren_string, paren_string_rest, paren_grid, paren_pos, virtual_pos, counter, i, j, msgboxdata @@ -342,22 +342,22 @@ class BuffEditableTextList : EditableTextList( paren_string := "" paren_string_rest := "" paren_grid := table() - + if member(paren_closing, contents[cursor_y, cursor_x - 1]) then { every i := 1 to self.cursor_y - 1 do { paren_string ||:= self.contents[i] insert(paren_grid, i, self.contents[i]) } virtual_pos := *paren_string + self.cursor_x - + paren_string_rest := self.contents[self.cursor_y] paren_string_rest := paren_string_rest[1:self.cursor_x+1] paren_string||:=paren_string_rest insert(paren_grid, self.cursor_y, paren_string_rest) - + paren_pos := paren.test(\paren_string, virtual_pos) - + if \paren_pos then { counter := 0 self.old_cursor_y := self.cursor_y @@ -379,7 +379,7 @@ class BuffEditableTextList : EditableTextList( } fail end - + # # The virtual x position of a line in the canvas, except # that we have line numbering turned on at the left. @@ -465,39 +465,39 @@ class BuffEditableTextList : EditableTextList( left_string_unicon (self.cbwin, xp, yp, detab(s), i) - if (v.index = \self.cursor_y) & + if (v.index = \self.cursor_y) & (v.first <= \self.cursor_x <= v.last) then { if \self.has_focus then { cw := Clone(self.cbwin, - "bg="||uidlog.ui_Preferences.cursor_highlight_color, + "bg="||uidlog.ui_Preferences.cursor_highlight_color, "fg="||uidlog.ui_Preferences.cursor_text_color) off := TextWidthEx(self.cbwin, s, 1, si, self.tab_width) - EraseRectangle(cw, xp + off, yp - self.line_height / 2, + EraseRectangle(cw, xp + off, yp - self.line_height / 2, CharWidth(self.cbwin, s[si]), self.line_height) if s[si] ~== "\t" then left_string(cw, xp + off, yp, s[si]) Uncouple(cw) - } + } else { cw := Clone(self.cbwin, - "fg="||uidlog.ui_Preferences.cursor_highlight_color) - Rectangle(cw, - xp + TextWidthEx(self.cbwin, s, 1, si, self.tab_width), - 1 + yp - self.line_height / 2, - CharWidth(self.cbwin, s[si]), + "fg="||uidlog.ui_Preferences.cursor_highlight_color) + Rectangle(cw, + xp + TextWidthEx(self.cbwin, s, 1, si, self.tab_width), + 1 + yp - self.line_height / 2, + CharWidth(self.cbwin, s[si]), self.line_height) Uncouple(cw) } } if \self.mark_y then { - if (self.mark_y < v.index < self.cursor_y) | + if (self.mark_y < v.index < self.cursor_y) | (self.mark_y > v.index > self.cursor_y) then { # Whole line selected r := [v.first, v.last] - } + } else if v.index = self.mark_y = self.cursor_y then { # Part of line if self.mark_x < self.cursor_x then { @@ -506,19 +506,19 @@ class BuffEditableTextList : EditableTextList( else if self.mark_x > self.cursor_x then { r := range(v.first, v.last, self.cursor_x + 1 , self.mark_x) } - } + } else if v.index = self.mark_y then { if self.mark_y < self.cursor_y then { r := range(v.first, v.last, self.mark_x, *self.contents[v.index] + 1) - } + } else { r := range(v.first, v.last, 1, self.mark_x) } - } + } else if v.index = self.cursor_y then { if self.mark_y > self.cursor_y then { r := range(v.first, v.last, self.cursor_x + 1, *self.contents[v.index] + 1) - } + } else { r := range(v.first, v.last, 1, self.cursor_x) } @@ -544,12 +544,12 @@ class BuffEditableTextList : EditableTextList( if \self.has_focus then { scroll_y := &y - # five for each press - handle_key_down() - handle_key_down() - handle_key_down() - handle_key_down() - handle_key_down() + # five for each press + handle_key_down() + handle_key_down() + handle_key_down() + handle_key_down() + handle_key_down() while ::Event() === &mdrag do { if &y > scroll_y then { @@ -598,7 +598,7 @@ class BuffEditableTextList : EditableTextList( # Exit this method return } - } + } # Reinitialize error counter in the yyerror function. This is done in # order to avoid the istop() function being called from within the @@ -645,7 +645,7 @@ class BuffEditableTextList : EditableTextList( # Add the offset to the x position x +:= off } - + # Draw the rest of the string s that was not a token Fg(win, prefs.comment_text_color)#Very Dark Green } @@ -681,44 +681,44 @@ class BuffEditableTextList : EditableTextList( x := 1 s := copy(GetCode()) | [] - # Extract the line number offset + # Extract the line number offset lineNumberOffset := pop(s) - # Call the preprocessor but instead of passing a file name, + # Call the preprocessor but instead of passing a file name, # pass a list containing the code. - preproc_err_count := 0 + preproc_err_count := 0 yyin := "" every yyin ||:= preprocessor(s, uni_predefs) do yyin ||:= "\n" - if preproc_err_count = 0 then { - # Reinitialize lexical analyzer - yylex_reinit() - # Initialize variables - /yydebug := 0 - parsingErrors := [] - # Reparse the code - rv := yyparse() - } - # Display errors + if preproc_err_count = 0 then { + # Reinitialize lexical analyzer + yylex_reinit() + # Initialize variables + /yydebug := 0 + parsingErrors := [] + # Reparse the code + rv := yyparse() + } + # Display errors if errors + (\yynerrs|0) + preproc_err_count > 0 then { every errorObject := !parsingErrors do { # display the error errorObject.lineNumber +:= lineNumberOffset - if errorObject.lineNumber <= *contents then { - SetErrorLineNumber(errorObject.lineNumber) - uidlog.MsgBox.set_contents([errorObject.lineNumber ||": " || - errorObject.errorMessage]) - } + if errorObject.lineNumber <= *contents then { + SetErrorLineNumber(errorObject.lineNumber) + uidlog.MsgBox.set_contents([errorObject.lineNumber ||": " || + errorObject.errorMessage]) + } } } - else uidlog.MsgBox.set_contents(["(no errors)"]) - doReparse := 0 - } + else uidlog.MsgBox.set_contents(["(no errors)"]) + doReparse := 0 + } end method GetCode() local codeSubStringList, originalPositionY, currentPositionY, token, startPositionY := 0, endPositionY := 0, endsneeded, - inClass := 0, inMethod := 0 + inClass := 0, inMethod := 0 # reset parser reinitialize() @@ -739,12 +739,12 @@ class BuffEditableTextList : EditableTextList( break } METHOD : { - inMethod := 1 + inMethod := 1 startPositionY := currentPositionY break } CLASS : { - inClass := 1 + inClass := 1 startPositionY := currentPositionY break } @@ -762,26 +762,26 @@ class BuffEditableTextList : EditableTextList( # Reinitialize lexical analyzer yyin := contents[ currentPositionY ] yylex_reinit() - while countdoublequotes(yyin)%2=1 & yyin[-1]=="_" do { - currentPositionY +:= 1 - if not (yyin ||:= contents[ currentPositionY ]) then { - break break - } - } + while countdoublequotes(yyin)%2=1 & yyin[-1]=="_" do { + currentPositionY +:= 1 + if not (yyin ||:= contents[ currentPositionY ]) then { + break break + } + } yylex_reinit() # Get string s tokens while ( token := yylex() ) ~=== EOFX do { # Get tokens case token of { END: { - endPositionY := currentPositionY - break + endPositionY := currentPositionY + break } CLASS | PROCEDURE: { - if currentPositionY ~= startPositionY then { - endPositionY := currentPositionY-1 - break - } + if currentPositionY ~= startPositionY then { + endPositionY := currentPositionY-1 + break + } } default : break } @@ -793,26 +793,26 @@ class BuffEditableTextList : EditableTextList( # Check if a valid enclosing end was found if endPositionY = 0 then { # Return all code - codeSubStringList := [ 0 ] ||| contents + codeSubStringList := [ 0 ] ||| contents return codeSubStringList } # Send only the enclosing sub string list if startPositionY = 0 then startPositionY := 1 if inMethod = 1 then { - codeSubStringList := [ startPositionY, "class __Parse()" ] ||| - contents[ startPositionY : endPositionY+1 ]||| - ["end"] - } + codeSubStringList := [ startPositionY, "class __Parse()" ] ||| + contents[ startPositionY : endPositionY+1 ]||| + ["end"] + } else if inClass = 1 then { - codeSubStringList := [ startPositionY ] ||| - contents[ startPositionY : endPositionY+1 ]||| - ["end"] - } + codeSubStringList := [ startPositionY ] ||| + contents[ startPositionY : endPositionY+1 ]||| + ["end"] + } else { - codeSubStringList := [ startPositionY ] ||| - contents[ startPositionY : endPositionY+1 ] - } + codeSubStringList := [ startPositionY ] ||| + contents[ startPositionY : endPositionY+1 ] + } # check what we came up with to parse # every write("\t", codeSubStringList[2 to *codeSubStringList]) return codeSubStringList @@ -844,14 +844,14 @@ procedure countdoublequotes(s) local i := 0 s ? { while tab(upto('"\\')) do { - if ="\"" then - i +:= 1 - else { - move(1) # eat \\ - if i % 2 = 1 then - move(1) # eat escaped things; should make smarter - } - } + if ="\"" then + i +:= 1 + else { + move(1) # eat \\ + if i % 2 = 1 then + move(1) # eat escaped things; should make smarter + } + } } return i end diff --git a/uni/ide/classbrowser.icn b/uni/ide/classbrowser.icn index 2ae634c30..f1b54239a 100644 --- a/uni/ide/classbrowser.icn +++ b/uni/ide/classbrowser.icn @@ -1,10 +1,10 @@ ############################################################################### # -# File: classbrowser.icn +# File: classbrowser.icn # -# Subject: Class Browser +# Subject: Class Browser # -# Author: Nolan Clayton +# Author: Nolan Clayton # # Date: September 22, 2003 # @@ -14,14 +14,14 @@ # class browser for icon/unicon programs. # # ex. -Files -# |--foo.icn -# |-+class blah -# |--class whatever -# | |--method bees -# |--procedure good +# |--foo.icn +# |-+class blah +# |--class whatever +# | |--method bees +# |--procedure good # # -# result from--> classbrowser foo.icn +# result from--> classbrowser foo.icn # ############################################################################### # Links: graphics @@ -32,7 +32,7 @@ $include "guih.icn" # # class ClassBrowser : is a subclass of Tree used to overide the draw and -# other methods. +# other methods. # class ClassBrowser : Tree( last_selected, @@ -40,7 +40,7 @@ class ClassBrowser : Tree( files_root) # - # Draw Method: Each node depending on its type is drawn + # Draw Method: Each node depending on its type is drawn # with a different image. # method draw_line(xp, yp, i, selection_cw, cursor_cw, highlight_cw) @@ -50,71 +50,71 @@ class ClassBrowser : Tree( dashed := Clone(cbwin, "pattern=gray", "fillstyle=textured") lp := xp every j := 1 to N.depth - 1 do { - if any('fd', N.draw_line[j]) then - DrawLine(dashed, lp + col_w / 2, yp - line_height / 2, - lp + col_w / 2, yp + line_height / 2) - lp +:= col_w # should this be in the preceding then-block? - } - if N.depth > 0 then { - if N.draw_line[N.depth] == "d" then - DrawLine(dashed, lp + col_w / 2, yp, lp + col_w / 2, - yp + line_height / 2) - else if N.draw_line[N.depth] == "f" then - DrawLine(dashed, lp + col_w / 2, yp - line_height / 2, - lp + col_w / 2, yp + line_height / 2) - else if N.draw_line[N.depth] == "u" then - DrawLine(dashed, lp + col_w / 2, yp - line_height / 2, - lp + col_w / 2, yp) - DrawLine(dashed, lp + col_w / 2, yp, lp + col_w + col_w / 2, yp) - lp +:= col_w - } + if any('fd', N.draw_line[j]) then + DrawLine(dashed, lp + col_w / 2, yp - line_height / 2, + lp + col_w / 2, yp + line_height / 2) + lp +:= col_w # should this be in the preceding then-block? + } + if N.depth > 0 then { + if N.draw_line[N.depth] == "d" then + DrawLine(dashed, lp + col_w / 2, yp, lp + col_w / 2, + yp + line_height / 2) + else if N.draw_line[N.depth] == "f" then + DrawLine(dashed, lp + col_w / 2, yp - line_height / 2, + lp + col_w / 2, yp + line_height / 2) + else if N.draw_line[N.depth] == "u" then + DrawLine(dashed, lp + col_w / 2, yp - line_height / 2, + lp + col_w / 2, yp) + DrawLine(dashed, lp + col_w / 2, yp, lp + col_w + col_w / 2, yp) + lp +:= col_w + } bmps := \N.bmps | default_bmps if (*N.subnodes = 0) & /N.always_expandable_flag then - img := bmps[3] + img := bmps[3] else { - if N.is_expanded() then { - img := bmps[2] - little := minus - if *N.subnodes > 0 then - DrawLine(dashed, lp + col_w / 2, yp, lp + col_w / 2, - yp + line_height / 2) - } - else { - img := bmps[1] - little := plus - } - if not (N.type == ("class" | "editor" | "file")) then - little := editorimgs("elbow") - - temp := editorimgs(N.type) - if \temp then img := temp - - EraseArea(cbwin, lp - col_w / 2 - little_w / 2, - yp - little_h / 2, little_w, little_h) - DrawImageEx(cbwin, lp - col_w / 2 - little_w / 2, - yp - little_h/2, little) - } + if N.is_expanded() then { + img := bmps[2] + little := minus + if *N.subnodes > 0 then + DrawLine(dashed, lp + col_w / 2, yp, lp + col_w / 2, + yp + line_height / 2) + } + else { + img := bmps[1] + little := plus + } + if not (N.type == ("class" | "editor" | "file")) then + little := editorimgs("elbow") + + temp := editorimgs(N.type) + if \temp then img := temp + + EraseArea(cbwin, lp - col_w / 2 - little_w / 2, + yp - little_h / 2, little_w, little_h) + DrawImageEx(cbwin, lp - col_w / 2 - little_w / 2, + yp - little_h/2, little) + } DrawImageEx(cbwin, lp + col_w / 2 - bmp_w / 2, yp - bmp_h / 2, img) left_string(cbwin, lp + col_w + HIGHLIGHT_TEXT_SPACING, yp, N.label) if \selection_cw then - FillRectangle(selection_cw, lp + col_w, yp - line_height / 2, - TextWidth(cbwin, N.label) + - 2 * HIGHLIGHT_TEXT_SPACING, line_height) + FillRectangle(selection_cw, lp + col_w, yp - line_height / 2, + TextWidth(cbwin, N.label) + + 2 * HIGHLIGHT_TEXT_SPACING, line_height) if \cursor_cw then { - Rectangle(cursor_cw, lp + col_w, yp - line_height / 2, - TextWidth(cbwin, N.label) + 2 * HIGHLIGHT_TEXT_SPACING, - line_height) - } + Rectangle(cursor_cw, lp + col_w, yp - line_height / 2, + TextWidth(cbwin, N.label) + 2 * HIGHLIGHT_TEXT_SPACING, + line_height) + } if \highlight_cw then { - Rectangle(highlight_cw, lp + col_w, yp - line_height / 2, - TextWidth(cbwin, N.label) + 2 * HIGHLIGHT_TEXT_SPACING, - line_height) - } + Rectangle(highlight_cw, lp + col_w, yp - line_height / 2, + TextWidth(cbwin, N.label) + 2 * HIGHLIGHT_TEXT_SPACING, + line_height) + } Uncouple(dashed) end @@ -126,38 +126,38 @@ class ClassBrowser : Tree( method handle_press(e) local l, lno, N, curr_sel, yp, xp, c, i if (view.x <= &x < view.x + view.w) & - (view.y <= &y < view.y + view.h) then { - lno := (&y - view.y) / line_height - l := lno + get_first_line() - - if l <= get_last_line() then { - N := contents[l] - - if (N.depth > 0) & (*N.subnodes > 0) | - \N.always_expandable_flag then { - # - # Check for click on little +/- icon. - # - yp := view.y + line_height / 2 + line_height * lno - little_h /2 - xp := get_left_pos() + (N.depth - 1) * col_w + little_w / 2 - if (xp <= &x < xp + little_w) & (yp <= &y < yp + little_h) then{ - # - # Clicking on the little icon ends the sequence, and sets - # the selection to the given node. - # - start_handle(e) - curr_sel := object_get_selections() - N.toggle_expanded() - last_expanded := N - tree_structure_changed() - is_held := &null - if not lang::equals(object_get_selections(), curr_sel) then - selchange := 1 - fire(TREE_NODE_EXPANSION_EVENT, e) - end_handle(e) - } - } - if find(".icn",N.parentfile) then { + (view.y <= &y < view.y + view.h) then { + lno := (&y - view.y) / line_height + l := lno + get_first_line() + + if l <= get_last_line() then { + N := contents[l] + + if (N.depth > 0) & (*N.subnodes > 0) | + \N.always_expandable_flag then { + # + # Check for click on little +/- icon. + # + yp := view.y + line_height / 2 + line_height * lno - little_h /2 + xp := get_left_pos() + (N.depth - 1) * col_w + little_w / 2 + if (xp <= &x < xp + little_w) & (yp <= &y < yp + little_h) then{ + # + # Clicking on the little icon ends the sequence, and sets + # the selection to the given node. + # + start_handle(e) + curr_sel := object_get_selections() + N.toggle_expanded() + last_expanded := N + tree_structure_changed() + is_held := &null + if not lang::equals(object_get_selections(), curr_sel) then + selchange := 1 + fire(TREE_NODE_EXPANSION_EVENT, e) + end_handle(e) + } + } + if find(".icn",N.parentfile) then { every i:=!uidlog.FileTabSet.children do { if i.label == N.parentfile then { c := uidlog.FileTabSet.get_tabitem(N.parentfile) @@ -168,7 +168,7 @@ class ClassBrowser : Tree( uidlog.FileTabSet.set_which_one(\c) } } - } + } last_selected := contents[1] goto(N.lineno) } @@ -207,33 +207,33 @@ class ClassBrowser : Tree( # # Node Replace Method: Remove a Node with the same label as Tab Label - # from the tree (class browser). + # from the tree (class browser). method nodereplace(tab_label) local i every i := 1 to *files_root.subnodes do - if tab_label == files_root.subnodes[i].label then { - files_root.subnodes := files_root.subnodes[1 : i] ||| - files_root.subnodes[i + 1 : 0] - return - } + if tab_label == files_root.subnodes[i].label then { + files_root.subnodes := files_root.subnodes[1 : i] ||| + files_root.subnodes[i + 1 : 0] + return + } set_root_node(files_root) end # # Go To Method: A Node was clicked. Set the focus on Tab with the label # Tab Label and go to and highlight the line number Line. - # + # method goto(line) local ceb, comment_adjust:=0, i:=1 ceb := ide.CurrentEditBox() - + if find("#", ceb.contents[line-2] | ceb.contents[line-1]) then { comment_adjust +:= 2 every i := 3 to 6 do if find("#", ceb.contents[line-i]) then comment_adjust +:= 1 } - + ceb.ensure_row_visible(line + ceb.get_max_lines()) ceb.ensure_row_visible(line - comment_adjust) ceb.start_handle() @@ -247,7 +247,7 @@ class ClassBrowser : Tree( end initially() - self$Tree.initially() + self$Tree.initially() fileimgs := table() files_root := Tag("editor", "Editor",0, &null) end @@ -256,9 +256,9 @@ end # class Tag : is a subclass of Node used only to keep track of Node attribs # class Tag : Node ( - type, # what kind of node it is (method, $include, procedure). - lineno, # The line number on which the Node occurs. - parentfile # The label(Tab Item) of file in which the Node is a member. + type, # what kind of node it is (method, $include, procedure). + lineno, # The line number on which the Node occurs. + parentfile # The label(Tab Item) of file in which the Node is a member. ) method settype( x ) @@ -290,7 +290,7 @@ initially (args[]) if *\args > 3 then { type := args[1] self$set_label( args[2] ) - lineno := args[3] + lineno := args[3] parentfile := args[4] } set_always_expandable() diff --git a/uni/ide/configopt.icn b/uni/ide/configopt.icn index 537377b82..f48bb6880 100644 --- a/uni/ide/configopt.icn +++ b/uni/ide/configopt.icn @@ -4,7 +4,7 @@ $include "guih.icn" class ConfigureOptions : Dialog(ok_btn, cancel_btn, comp_lbl_4, uniconCompilerCmd_txt, uniconCompilerFlgs_txt, uniconCompiler_lst, uniconLinkerFlgs_txt, - uniconLinker_txt, comp_lbl, compflags_lbl, linker_lbl, linkerflags_lbl, + uniconLinker_txt, comp_lbl, compflags_lbl, linker_lbl, linkerflags_lbl, makefileOpts_tabset, unicon_tab_options, uniconCompilerslist ) method component_setup() @@ -14,7 +14,7 @@ class ConfigureOptions : Dialog(ok_btn, method end_dialog() end - method init_dialog() + method init_dialog() uniconCompilerslist:=["unicon", "wicont"] uniconCompiler_lst.set_selection_list(uniconCompilerslist) end @@ -30,7 +30,7 @@ class ConfigureOptions : Dialog(ok_btn, method on_uniconCompiler_lst(ev) uniconCompilerCmd_txt.set_contents(uniconCompilerslist[uniconCompiler_lst.get_selection()]) uniconCompilerFlgs_txt.set_contents("-c") - uniconLinker_txt.set_contents(uniconCompilerslist[uniconCompiler_lst.get_selection()]) + uniconLinker_txt.set_contents(uniconCompilerslist[uniconCompiler_lst.get_selection()]) uniconLinkerFlgs_txt.set_contents(" ") end diff --git a/uni/ide/funclookup.icn b/uni/ide/funclookup.icn index b3a175769..abed43ffa 100644 --- a/uni/ide/funclookup.icn +++ b/uni/ide/funclookup.icn @@ -33,203 +33,203 @@ class known_funcs (built_ins, usr_func_table, reserved_words, keywords) method load_BInames() local f, func_name built_ins := set( [ - "abs","acos","any","args","asin","atan","atanh", - "bal", - "center","channel","char","chdir","chmod","classname", - "close","cofail","collect","condvar","constructor", - "copy","cos","cset","ctime", - "dbcolumns","dbdriver","dbkeys","dblimits","dbproduct","dbtables", - "delay","delete","detab","display","dtor", - "entab","errorclear","eventmask", - "EvGet","EvSend","exit","exp", - "fetch","fieldnames","find","flock","flush","function", - "get","getch","getche","getenv","gettimeofday","globalnames","gtime", - "iand","icom","image","insert","integer", - "ior","ishift","istate","ixor", - "kbhit","key","keyword", - "left","list","load","loadfunc","localnames","lock","log", - "many","map","match","max","member","membernames","methodnames", - "methods","min","mkdir","move","mutex", - "name","numeric", - "open","opmask","oprec","ord", - "paramnames","parent","pipe","pop","pos","proc","pull","push","put", - "read","reads","ready","real","receive","remove","rename","repl", - "reverse","right","rmdir","rtod","runerr", - "seek","select","send","seq","serial","set","setenv", - "signal","sin","sort","sortf","spawn","sql","sqrt", - "stat","staticnames","stop","string","system", - "tab","table","tan","trap","trim","truncate","trylock","type", - "unlock","upto","utime", - "variable", - "wait","where","write","writes", - "Active","Alert", - "Bg", - "Clip","Clone","Color","ColorValue","CopyArea","Couple", - "DrawArc","DrawCircle","DrawCube","DrawCurve","DrawCylinder", - "DrawDisk","DrawImage","DrawLine","DrawPoint","DrawPolygon", - "DrawRectangle","DrawSegment","DrawSphere","DrawString","DrawTorus", - "EraseArea","Event", - "Fg","FillArc","FillCircle","FillPolygon","FillRectangle", - "Font","FreeColor", - "GotoRC","GotoXY", - "IdentityMatrix", - "Lower", - "MatrixMode","MultMatrix", - "NewColor", - "PaletteChars","PaletteColor","PaletteKey","Pattern","Pending", - "Pixel","PopMatrix","PushMatrix", - "PushRotate","PushScale","PushTranslate", - "QueryPointer", - "Raise","ReadImage","Refresh", "Rotate", - "Scale", - "Texcoord","TextWidth","Texture","Translate", - "Uncouple", - "WAttrib","WDefault","WFlush","WindowContents", - "WriteImage","WSection","WSync", - "Abort","Any","Arb","Arbno", - "Bal","Break","Breakx", - "Fail","Fence", - "Len", - "NotAny","Nspan", - "Pos", - "Rem","Rpos","Rtab", - "Span","Succeed", - "Tab", - "chown","chroot","crypt", - "exec", - "fcntl","fdup","filepair","fork", - "getegid","geteuid","getgid","getgr","gethost", - "getpgrp","getpid","getppid","getpw","getserv","getuid", - "hardlink", - "kill", - "readlink", - "setgid","setgrent","sethostent","setpgrp","setpwent", - "setservent","setuid","symlink","sys_errstr", - "umask", - "wait", - "WinButton","WinColorDialog","WinEditRegion","WinFontDialog", - "WinMenuBar","WinOpenDialog","WinPlayMedia","WinSaveDialog", - "WinScrollBar","WinSelectDialog"]) + "abs","acos","any","args","asin","atan","atanh", + "bal", + "center","channel","char","chdir","chmod","classname", + "close","cofail","collect","condvar","constructor", + "copy","cos","cset","ctime", + "dbcolumns","dbdriver","dbkeys","dblimits","dbproduct","dbtables", + "delay","delete","detab","display","dtor", + "entab","errorclear","eventmask", + "EvGet","EvSend","exit","exp", + "fetch","fieldnames","find","flock","flush","function", + "get","getch","getche","getenv","gettimeofday","globalnames","gtime", + "iand","icom","image","insert","integer", + "ior","ishift","istate","ixor", + "kbhit","key","keyword", + "left","list","load","loadfunc","localnames","lock","log", + "many","map","match","max","member","membernames","methodnames", + "methods","min","mkdir","move","mutex", + "name","numeric", + "open","opmask","oprec","ord", + "paramnames","parent","pipe","pop","pos","proc","pull","push","put", + "read","reads","ready","real","receive","remove","rename","repl", + "reverse","right","rmdir","rtod","runerr", + "seek","select","send","seq","serial","set","setenv", + "signal","sin","sort","sortf","spawn","sql","sqrt", + "stat","staticnames","stop","string","system", + "tab","table","tan","trap","trim","truncate","trylock","type", + "unlock","upto","utime", + "variable", + "wait","where","write","writes", + "Active","Alert", + "Bg", + "Clip","Clone","Color","ColorValue","CopyArea","Couple", + "DrawArc","DrawCircle","DrawCube","DrawCurve","DrawCylinder", + "DrawDisk","DrawImage","DrawLine","DrawPoint","DrawPolygon", + "DrawRectangle","DrawSegment","DrawSphere","DrawString","DrawTorus", + "EraseArea","Event", + "Fg","FillArc","FillCircle","FillPolygon","FillRectangle", + "Font","FreeColor", + "GotoRC","GotoXY", + "IdentityMatrix", + "Lower", + "MatrixMode","MultMatrix", + "NewColor", + "PaletteChars","PaletteColor","PaletteKey","Pattern","Pending", + "Pixel","PopMatrix","PushMatrix", + "PushRotate","PushScale","PushTranslate", + "QueryPointer", + "Raise","ReadImage","Refresh", "Rotate", + "Scale", + "Texcoord","TextWidth","Texture","Translate", + "Uncouple", + "WAttrib","WDefault","WFlush","WindowContents", + "WriteImage","WSection","WSync", + "Abort","Any","Arb","Arbno", + "Bal","Break","Breakx", + "Fail","Fence", + "Len", + "NotAny","Nspan", + "Pos", + "Rem","Rpos","Rtab", + "Span","Succeed", + "Tab", + "chown","chroot","crypt", + "exec", + "fcntl","fdup","filepair","fork", + "getegid","geteuid","getgid","getgr","gethost", + "getpgrp","getpid","getppid","getpw","getserv","getuid", + "hardlink", + "kill", + "readlink", + "setgid","setgrent","sethostent","setpgrp","setpwent", + "setservent","setuid","symlink","sys_errstr", + "umask", + "wait", + "WinButton","WinColorDialog","WinEditRegion","WinFontDialog", + "WinMenuBar","WinOpenDialog","WinPlayMedia","WinSaveDialog", + "WinScrollBar","WinSelectDialog"]) end method load_reserved_words() reserved_words := table( - "abstract", "declare unimplemented method", - "break", "exits the enclosing loop", - "by", "specifies the increment used in generating i to j", - "case", "selects code from alternative values", - "class", "declares a new object type", - "create", "constructs an independent co-expression context", - "critical", "declares a non-concurrent code block", - "default", "indicates a branch of code to execute", - "do", "identifies the body of a loop", - "else", "specifies what to do if a then-part is not executed", - "end", "indicates the end of a procedure, method, or class", - "every", "requires all the elements from a generator", - "fail", "exits the procedure immediately with no return value", - "global", "declares variables visible throughout the program", - "if", "executes some code only when an expression succeeds", - "import", "introduces symbols defined in a package", - "initial", "gives an expression that executes only on the first call", - "initially", "executes code each time a class instance is created", - "invocable", "declares procedures that may be called indirectly", - "link", "declares library modules that may be used in this program", - "local", "declares variables used within a procedure or method call", - "method", "declares a block of code that operates on class instances", - "next", "executes the next iteration of a loop", - "not", "succeeds if the following expression fails", - "of", "identifies the body of a case expression", - "package", "declares this module to be a member of the named package", - "procedure", "declares a block of code that may be called by name", - "record", "declares a new type with fields accessed by name", - "repeat", "declares a loop that will execute any number of times", - "return", "exits the procedure immediately, with a return value", - "static", "declares variables that retain values across calls", - "suspend", "produces a value to the caller, allowing resumption", - "then", "identifies the conditional part of an if expression", - "thread", "executes an expression concurrently", - "to", "generates incremental values between a start and an end", - "until", "gives an expression that allows a loop to terminate", - "while", "gives an expression that allows a loop to continue" - ) + "abstract", "declare unimplemented method", + "break", "exits the enclosing loop", + "by", "specifies the increment used in generating i to j", + "case", "selects code from alternative values", + "class", "declares a new object type", + "create", "constructs an independent co-expression context", + "critical", "declares a non-concurrent code block", + "default", "indicates a branch of code to execute", + "do", "identifies the body of a loop", + "else", "specifies what to do if a then-part is not executed", + "end", "indicates the end of a procedure, method, or class", + "every", "requires all the elements from a generator", + "fail", "exits the procedure immediately with no return value", + "global", "declares variables visible throughout the program", + "if", "executes some code only when an expression succeeds", + "import", "introduces symbols defined in a package", + "initial", "gives an expression that executes only on the first call", + "initially", "executes code each time a class instance is created", + "invocable", "declares procedures that may be called indirectly", + "link", "declares library modules that may be used in this program", + "local", "declares variables used within a procedure or method call", + "method", "declares a block of code that operates on class instances", + "next", "executes the next iteration of a loop", + "not", "succeeds if the following expression fails", + "of", "identifies the body of a case expression", + "package", "declares this module to be a member of the named package", + "procedure", "declares a block of code that may be called by name", + "record", "declares a new type with fields accessed by name", + "repeat", "declares a loop that will execute any number of times", + "return", "exits the procedure immediately, with a return value", + "static", "declares variables that retain values across calls", + "suspend", "produces a value to the caller, allowing resumption", + "then", "identifies the conditional part of an if expression", + "thread", "executes an expression concurrently", + "to", "generates incremental values between a start and an end", + "until", "gives an expression that allows a loop to terminate", + "while", "gives an expression that allows a loop to continue" + ) end method load_keywords() keywords := table( - "&allocated", "produces the space used in the storage regions", - "&ascii", "is a cset consisting of the 128 ASCII characters", - "&clock", "is a string consisting of the current time of day", - "&col", "is the mouse horizontal position, in text columns", - "&collections", "is the number of garbage collections", - "&column", "is the source column number of the execution point", - "&control", "succeeds if the control key was pressed last event", - "&cset", "is a cset consisting of all the 256 characters", - "¤t", "is the current active co-expression", - "&date", "is the current date", - "&dateline", "is the current date and time", - "&digits", "is a cset consisting of the decimal digits", - "&dump", "is a variable that controls termination dump", - "&e", "is the base of the natural logarithms", - "&errno", "contains an error number from a previous system call", - "&error", "is a variable that enables/disables error conversion", - "&errornumber", "is the error number of last error converted to failure", - "&errortext", "is the error message of the last error converted to failure", - "&errorvalue", "is the erroneous value of the last error converted to failure", - "&errout", "is the standard error output file", - "&eventcode", "indicates the most recent event in a monitored program", - "&eventsource", "gives the source of events in a monitor program", - "&eventvalue", "is the value associated with the most recent event in a monitored program", - "&fail", "is an expression that fails", - "&features", "generates strings identifying features in this implementation", - "&file", "is the name of the source file at the execution point", - "&host", "identifies the host computer", - "&input", "is the standard input file", - "&interval", "gives the milliseconds since the previous event", - "&lcase", "is a cset consisting of the 26 lower case letters", - "&ldrag", "is the integer code for a left drag event", - "&letters", "is a cset consisting of the 52 upper and lower case letters", - "&level", "is the depth (from main) of the current call", - "&line", "is the source line number of the execution point", - "&lpress", "is the integer code for a left press event", - "&lrelease", "is the integer code for a left release event", - "&main", "is the main co-expression", - "&mdrag", "is the integer code for a middle-button drag event", - "&meta", "succeeds if the meta/alt key was pressed last input event", - "&mpress", "is the integer code for a middle-button press event", - "&mrelease", "is the integer code for a middle-button release event", - "&now", "is the current system time", - "&null", "is a null value", - "&output", "is the standard output file", - "&phi", "is the golden ratio, 1.618...", - "&pi", "is pi, 3.1415...", - "&pick", "contains the result of 3D selection", - "&pos", "is the index position at which the subject is being scanned", - "&progname", "contains the program name", - "&random", "is a variable that contains the current seed for random operations", - "&rdrag", "is the integer code for a right-button drag event", - "®ions", "generates the regions' sizes", - "&resize", "is the integer code for a window resize event", - "&row", "is the mouse vertical position in text rows", - "&rpress", "is the integer code for a right-button press event", - "&rrelease", "is the integer code for a right-button release event", - "&shift", "succeeds if the shift key was pressed at the last input event", - "&source", "is the co-expression that invoked the current co-expression", - "&storage", "generates the amount of storaged used for each region", - "&subject", "is the string being scanned", - "&time", "is the elapsed execution time in milliseconds", - "&trace", "is an integer specifying how many calls to trace", - "&ucase", "is a cset containing the 26 upper case letters", - "&version", "is the current unicon version", - "&window", "is the default graphics window", - "&x", "is the mouse x position at the time of the last input event", - "&y", "is the mouse y position at the time of the last input event", - ) + "&allocated", "produces the space used in the storage regions", + "&ascii", "is a cset consisting of the 128 ASCII characters", + "&clock", "is a string consisting of the current time of day", + "&col", "is the mouse horizontal position, in text columns", + "&collections", "is the number of garbage collections", + "&column", "is the source column number of the execution point", + "&control", "succeeds if the control key was pressed last event", + "&cset", "is a cset consisting of all the 256 characters", + "¤t", "is the current active co-expression", + "&date", "is the current date", + "&dateline", "is the current date and time", + "&digits", "is a cset consisting of the decimal digits", + "&dump", "is a variable that controls termination dump", + "&e", "is the base of the natural logarithms", + "&errno", "contains an error number from a previous system call", + "&error", "is a variable that enables/disables error conversion", + "&errornumber", "is the error number of last error converted to failure", + "&errortext", "is the error message of the last error converted to failure", + "&errorvalue", "is the erroneous value of the last error converted to failure", + "&errout", "is the standard error output file", + "&eventcode", "indicates the most recent event in a monitored program", + "&eventsource", "gives the source of events in a monitor program", + "&eventvalue", "is the value associated with the most recent event in a monitored program", + "&fail", "is an expression that fails", + "&features", "generates strings identifying features in this implementation", + "&file", "is the name of the source file at the execution point", + "&host", "identifies the host computer", + "&input", "is the standard input file", + "&interval", "gives the milliseconds since the previous event", + "&lcase", "is a cset consisting of the 26 lower case letters", + "&ldrag", "is the integer code for a left drag event", + "&letters", "is a cset consisting of the 52 upper and lower case letters", + "&level", "is the depth (from main) of the current call", + "&line", "is the source line number of the execution point", + "&lpress", "is the integer code for a left press event", + "&lrelease", "is the integer code for a left release event", + "&main", "is the main co-expression", + "&mdrag", "is the integer code for a middle-button drag event", + "&meta", "succeeds if the meta/alt key was pressed last input event", + "&mpress", "is the integer code for a middle-button press event", + "&mrelease", "is the integer code for a middle-button release event", + "&now", "is the current system time", + "&null", "is a null value", + "&output", "is the standard output file", + "&phi", "is the golden ratio, 1.618...", + "&pi", "is pi, 3.1415...", + "&pick", "contains the result of 3D selection", + "&pos", "is the index position at which the subject is being scanned", + "&progname", "contains the program name", + "&random", "is a variable that contains the current seed for random operations", + "&rdrag", "is the integer code for a right-button drag event", + "®ions", "generates the regions' sizes", + "&resize", "is the integer code for a window resize event", + "&row", "is the mouse vertical position in text rows", + "&rpress", "is the integer code for a right-button press event", + "&rrelease", "is the integer code for a right-button release event", + "&shift", "succeeds if the shift key was pressed at the last input event", + "&source", "is the co-expression that invoked the current co-expression", + "&storage", "generates the amount of storaged used for each region", + "&subject", "is the string being scanned", + "&time", "is the elapsed execution time in milliseconds", + "&trace", "is an integer specifying how many calls to trace", + "&ucase", "is a cset containing the 26 upper case letters", + "&version", "is the current unicon version", + "&window", "is the default graphics window", + "&x", "is the mouse x position at the time of the last input event", + "&y", "is the mouse y position at the time of the last input event", + ) end method open_reference(func_name) #load up remote or local utr8 documentation for built-ins uidlog.menubar.handle_help("doc/book/utr8.html#"||func_name, - "http://unicon.org/utr/utr8.html#"||func_name) + "http://unicon.org/utr/utr8.html#"||func_name) end method usr_funcs(usr_func_name) @@ -243,12 +243,12 @@ class known_funcs (built_ins, usr_func_table, reserved_words, keywords) method treeRecursion(N) local t every t := 0 to *N.subnodes do { - treeRecursion(N.subnodes[t]) - } + treeRecursion(N.subnodes[t]) + } if not (N.label[-4:0] == ".icn") then { - if not member(usr_func_table, N.label) then - insert(usr_func_table,N.label, N.lineno) - } + if not member(usr_func_table, N.label) then + insert(usr_func_table,N.label, N.lineno) + } end # Check user-defined and built in functions for the word under the cursor @@ -269,13 +269,13 @@ class known_funcs (built_ins, usr_func_table, reserved_words, keywords) treeRecursion(N.subnodes[1]) if member(built_ins, var_tocheck) then #if it's a built in - return 1 #open_reference(var_tocheck) + return 1 #open_reference(var_tocheck) else if member(usr_func_table, var_tocheck) then #if it's user defined - return 2 #usr_funcs(var_tocheck) + return 2 #usr_funcs(var_tocheck) else if member(reserved_words, var_tocheck) then #if it's a reserved word - return ["reserved word", reserved_words[var_tocheck]] + return ["reserved word", reserved_words[var_tocheck]] else if member(keywords, var_tocheck) then #if it's a keyword - return ["keyword", keywords[var_tocheck]] + return ["keyword", keywords[var_tocheck]] else return -1 end @@ -290,13 +290,13 @@ class known_funcs (built_ins, usr_func_table, reserved_words, keywords) non_whitespace := &cset -- ' \t(.' if any(non_whitespace,line,x) then { - while x > 1 & any(non_whitespace,line,x-1) do x -:= 1 - end_of_word := many(non_whitespace,line,x) - the_word := line[x:end_of_word] - #look it up in the table of known functions - #func_lookup(the_word) - return the_word - } + while x > 1 & any(non_whitespace,line,x-1) do x -:= 1 + end_of_word := many(non_whitespace,line,x) + the_word := line[x:end_of_word] + #look it up in the table of known functions + #func_lookup(the_word) + return the_word + } else return -1 #not a word end diff --git a/uni/ide/hfiledialog.icn b/uni/ide/hfiledialog.icn index 96d99fe4f..101694992 100644 --- a/uni/ide/hfiledialog.icn +++ b/uni/ide/hfiledialog.icn @@ -23,8 +23,8 @@ $endif # It maintains file extension information, defaulting to look for .icn files. # class HFileDialog : FileDialog( - file_extension, # File type extension - fext_list, # File extension list + file_extension, # File type extension + fext_list, # File extension list init_fileType ) @@ -37,7 +37,7 @@ class HFileDialog : FileDialog( # # Set the initial file/directory from a whole path. - # + # method set_path(s) self.FileDialog.set_path(s) self.init_fileType := "*.icn" @@ -58,11 +58,11 @@ class HFileDialog : FileDialog( # # Go to parent directory (unless at root directory) # - if \value == (".." || PATHCHAR) then { + if \value == (".." || PATHCHAR) then { if s ~== PATHCHAR then { s[-1] := "" while s[-1] ~== PATHCHAR do s[-1] := "" - } + } dir.set_contents(s) } else @@ -89,13 +89,13 @@ class HFileDialog : FileDialog( # # Go to parent directory (unless at root directory) # - if \value == (".." || PATHCHAR) then { - if s ~== PATHCHAR then { - s[-1] := "" - while s[-1] ~== PATHCHAR do s[-1] := "" - } - dir.set_contents(s) - } + if \value == (".." || PATHCHAR) then { + if s ~== PATHCHAR then { + s[-1] := "" + while s[-1] ~== PATHCHAR do s[-1] := "" + } + dir.set_contents(s) + } else dir.set_contents(s ||:= \value) # @@ -118,12 +118,12 @@ class HFileDialog : FileDialog( method on_flist_lpress(ev) local sb if get_click_count() = 2 then { - if (sb := \ (flist.vsb | flist.hsb)) & - (sb.x <= &x <= sb.x+sb.w) & (sb.y <= &y <= sb.y+sb.h) then - fail - set_result() - dispose() - } + if (sb := \ (flist.vsb | flist.hsb)) & + (sb.x <= &x <= sb.x+sb.w) & (sb.y <= &y <= sb.y+sb.h) then + fail + set_result() + dispose() + } end method on_dir() @@ -149,8 +149,8 @@ class HFileDialog : FileDialog( # Defaults if none set by caller. # if /init_dir | (init_dir == "") then { - init_dir := chdir() | PATHCHAR - } + init_dir := chdir() | PATHCHAR + } /init_file := "" /init_fileType := "" if (init_dir[-1] ~== PATHCHAR) then init_dir ||:= PATHCHAR @@ -177,26 +177,26 @@ class HFileDialog : FileDialog( file_extension.set_pos("100", "80") file_extension.set_size("100%-150", "20") file_extension.connect(self, "on_file_extension", - SELECTION_CHANGED_EVENT) + SELECTION_CHANGED_EVENT) file_extension.set_selection_list(["All Files(*.*)", - "Unicon Files(*.icn)", + "Unicon Files(*.icn)", "Project Files(*.uprj)"]) file_extension.set_selection(2) self.add(file_extension) l.set_linked_accel(file_extension) l := (get_directory_list(init_dir, - fext_list[file_extension.get_selection()]) | - [[],[]]) + fext_list[file_extension.get_selection()]) | + [[],[]]) dlist := TextList("pos=25,110", "size=50%-38,100%-170", "select_one", - "selection_on_key_moves=f") + "selection_on_key_moves=f") dlist.connect(self, "on_dlist", SELECTION_CHANGED_EVENT) dlist.set_contents(l[1]) self.add(dlist) flist := TextList("pos=50%+12,110", "size=50%-38,100%-170", "select_one", - "selection_on_key_moves=f") + "selection_on_key_moves=f") flist.connect(self, "on_flist", SELECTION_CHANGED_EVENT) flist.connect(self, "on_flist_lpress", MOUSE_PRESS_EVENT) flist.set_contents(l[2]) @@ -207,7 +207,7 @@ class HFileDialog : FileDialog( self.add(okay) cancel := TextButton("pos=66%,100%-30", "align=c,c", "label=Cancel", - "accel=c") + "accel=c") cancel.connect(self, "dispose", ACTION_EVENT) self.add(cancel) end diff --git a/uni/ide/ide.icn b/uni/ide/ide.icn index eda6f9953..640e8bfc7 100644 --- a/uni/ide/ide.icn +++ b/uni/ide/ide.icn @@ -52,7 +52,7 @@ class IDE ( local f, L, line, d d := pdialog() d.show_modal() - + # prn_name and copies_num are returned from PrintDialog(). if copies_num === &null then { uidlog.MsgBox.set_contents(["Printing canceled."]) @@ -66,11 +66,11 @@ class IDE ( # lpr -P prn_name -# copies_num if f := open(lpr || " -P " || prn_name || " -\# " || copies_num, "pw") then { - every write(f, trim(!L,'\^m')) - close(f) + every write(f, trim(!L,'\^m')) + close(f) } else - uidlog.MsgBox.set_contents(["Sorry, no printing yet."]) + uidlog.MsgBox.set_contents(["Sorry, no printing yet."]) end method on_new_btn(ev) @@ -101,33 +101,33 @@ class IDE ( if /filename then { $ifdef _UNIX - fd := HFileDialog() - - # set subdialog's position based on ide's position - # assume subdialog is 400x400 - dwidth := WAttrib(uidlog.win, "width") - dheight := WAttrib(uidlog.win, "height") - dposx := WAttrib(uidlog.win, "posx") + dwidth/2 - 200 - dposy := WAttrib(uidlog.win, "posy") + dheight/2 - 200 - # L := []; every put(L, QueryPointer(uidlog.win)) - # mousex := L[1]; mousey := L[2] - fd.attrib("pos=" || dposx || "," || dposy) + fd := HFileDialog() + + # set subdialog's position based on ide's position + # assume subdialog is 400x400 + dwidth := WAttrib(uidlog.win, "width") + dheight := WAttrib(uidlog.win, "height") + dposx := WAttrib(uidlog.win, "posx") + dwidth/2 - 200 + dposy := WAttrib(uidlog.win, "posy") + dheight/2 - 200 + # L := []; every put(L, QueryPointer(uidlog.win)) + # mousex := L[1]; mousey := L[2] + fd.attrib("pos=" || dposx || "," || dposy) fd.set_directory(CurrentTabItem().filedirectory) - fd.show_modal() - filename := fd.get_result() | fail - filedirectory := fd.get_directory() + fd.show_modal() + filename := fd.get_result() | fail + filedirectory := fd.get_directory() $else - filename := - WinOpenDialog(uidlog.win, "Open File ...", "", 5,,, - chdir(CurrentTabItem().filedirectory) + filename := + WinOpenDialog(uidlog.win, "Open File ...", "", 5,,, + chdir(CurrentTabItem().filedirectory) ) | fail $endif - } + } if /filename | filename=="" | filename[-1]==("\\"|"/") then return \uidlog.MsgBox.set_contents(["Error opening file \"" || - file_name(filename) || "\""]) + file_name(filename) || "\""]) # uidlog.MsgBox.set_contents("Enter File Name") if filename[-2:0]==(".*") then filename := filename[1:-2] @@ -137,34 +137,34 @@ $endif nchars := 0 if ufile := open(filename, "ru") then while line := read(ufile) do { - if line[-1] == "\^m" then line := line[1:-1] - put(file_contents, line) - nchars +:= *line + 1 - } + if line[-1] == "\^m" then line := line[1:-1] + put(file_contents, line) + nchars +:= *line + 1 + } # We don't have a file open with the same name, so # add a new tab with the file name if not member(opened_files_set, filename) then { - if is_binary(filename) then - uidlog.MsgBox.set_contents(["Cannot open binary "||filename]) - else { - new_tabitem(,1,file_name(filename),file_contents, filedirectory) + if is_binary(filename) then + uidlog.MsgBox.set_contents(["Cannot open binary "||filename]) + else { + new_tabitem(,1,file_name(filename),file_contents, filedirectory) \uidlog.MsgBox.set_contents(["opened " || filename || ", " || - *file_contents || " lines, " || - nchars || " characters"]) - uidlog.FileTabSet.set_which_one(CurrentTabItem()) - handle_update() - insert(opened_files_set, filename) - } - } + *file_contents || " lines, " || + nchars || " characters"]) + uidlog.FileTabSet.set_which_one(CurrentTabItem()) + handle_update() + insert(opened_files_set, filename) + } + } else { - c := uidlog.FileTabSet.get_tabitem(file_name(filename)) - uidlog.FileTabSet.set_which_one(\c) - } + c := uidlog.FileTabSet.get_tabitem(file_name(filename)) + uidlog.FileTabSet.set_which_one(\c) + } CurrentTabItem().filename := file_name(filename) CurrentTabItem().filedirectory := filename[1:-*CurrentTabItem().filename] uidlog.FileBrowser.addreplace(CurrentEditBox().contents, - uidlog.FileTabSet.which_one.filename, 0) + uidlog.FileTabSet.which_one.filename, 0) uidlog.FileTabSet.resize() uidlog.menubar.set_font() end @@ -222,23 +222,23 @@ $endif if c.label == (("Untitled"||(""|"*"))|("scratch"||(""|"*"))) then on_saveas_btn() else { - if c.label[-5:0] == ".icn*" then { - c.label := c.label[1:-1] - if not (save_file(c)) then c.label ||:= "*" - } - else - save_file(c) + if c.label[-5:0] == ".icn*" then { + c.label := c.label[1:-1] + if not (save_file(c)) then c.label ||:= "*" + } + else + save_file(c) } } end method on_saveas_btn(ev) local fd, filename, foo, index := i, warntxt, fexist := &null, L, - i, oldwindow, win, fileslist, fext, isUnicon := 1, filedirectory, - was_non_icn, c + i, oldwindow, win, fileslist, fext, isUnicon := 1, filedirectory, + was_non_icn, c if (\(ide.CurrentTabItem().filename))[-4:0] == ".icn" then - was_non_icn := &null + was_non_icn := &null else was_non_icn := 1 # this obviously is supposed to be used for something, and isn't yet. @@ -250,87 +250,87 @@ $endif chdir(CurrentTabItem().filedirectory) if /is_MSWindows then { - fd := HFileDialog() - fd.set_attribs("label=Save File As:") - fd.show_modal() - #fd.set_extra_attribs(["label=Save file As:"]) - filename := fd.get_result() | fail - filedirectory := fd.get_directory() + fd := HFileDialog() + fd.set_attribs("label=Save File As:") + fd.show_modal() + #fd.set_extra_attribs(["label=Save file As:"]) + filename := fd.get_result() | fail + filedirectory := fd.get_directory() # Append .icn under certain circumstances. Probably need to fix # circumstances. fext := fd.file_extension if not find(".", file_name(filename)) & file_name(filename) ~== "Makefile" & file_name(filename) ~== "makefile" & - find("Unicon Files", fext.selection_list[fext.get_selection()]) + find("Unicon Files", fext.selection_list[fext.get_selection()]) then filename ||:= ".icn" - } + } else { - filename := WinSaveDialog( + filename := WinSaveDialog( &window, "Save File As:", "", 50,,, - chdir(CurrentTabItem().filedirectory) + chdir(CurrentTabItem().filedirectory) ) | fail if filename[-2:0] == ".*" then filename[-2:0] := ".icn" - } + } if /filename | file_name(filename) ==".icn" | filename[-1]==("\\"|"/") then { - \uidlog.MsgBox.set_contents(["Error saving file " || - file_name(filename)]) - fail - } + \uidlog.MsgBox.set_contents(["Error saving file " || + file_name(filename)]) + fail + } every i := 1 to *fileslist do - if file_name(filename) === fileslist[i] then { + if file_name(filename) === fileslist[i] then { oldwindow := &window &window := win warntxt := UpdatedTextDialog ( "Overwrite file? ", - "A file named "|| file_name(filename) || " already" || + "A file named "|| file_name(filename) || " already" || " exists. Are you sure you want to overwrite it?") warntxt.show_modal() &window := oldwindow } if (overwrite === "OK") | /fexist then { - if \project then { - # Resolve absolute versus relative paths and not add absolute - # if relative is already in the project. - # Brute force version in place. - if (not find(map(filename), map(("" | (chdir() || PATHSEP)) || + if \project then { + # Resolve absolute versus relative paths and not add absolute + # if relative is already in the project. + # Brute force version in place. + if (not find(map(filename), map(("" | (chdir() || PATHSEP)) || (!menu_1.menus).get_label()))) & - find(".icn"|".u",filename) then { + find(".icn"|".u",filename) then { foo := TextMenuItem() foo.set_label(filename) menu_1.add(foo) self.resize() # recalc with new components in place } - } - - uidlog.FileBrowser.nodereplace(CurrentTabItem().filename) - CurrentTabItem().set_label(file_name(filename)) - L := CurrentEditBox().get_contents() | [] - uidlog.FileBrowser.addreplace(L, file_name(filename), 0) - CurrentTabItem().filename := file_name(filename) - CurrentTabItem().filedirectory := filename[1:-*file_name(filename)] - save_file(CurrentTabItem()) - - # If we changed from non-.icn to .icn extension, do a close/reopen - # to enable syntax coloring. Open first, so whole IDE doesn't exit + } + + uidlog.FileBrowser.nodereplace(CurrentTabItem().filename) + CurrentTabItem().set_label(file_name(filename)) + L := CurrentEditBox().get_contents() | [] + uidlog.FileBrowser.addreplace(L, file_name(filename), 0) + CurrentTabItem().filename := file_name(filename) + CurrentTabItem().filedirectory := filename[1:-*file_name(filename)] + save_file(CurrentTabItem()) + + # If we changed from non-.icn to .icn extension, do a close/reopen + # to enable syntax coloring. Open first, so whole IDE doesn't exit # if this is the only buffer. - if \was_non_icn & (filename[-4:0] == ".icn") then { + if \was_non_icn & (filename[-4:0] == ".icn") then { c := CurrentTabItem() - handle_openfile( , filename) - handle_closefile( , c) - } + handle_openfile( , filename) + handle_closefile( , c) + } - # The old IDE updated the file list on the File Menu when a - # project file save occurred. The new IDE should reload/reopen - # the project and update the navigation tree. - if CurrentTabItem().filename === project then updateproject() + # The old IDE updated the file list on the File Menu when a + # project file save occurred. The new IDE should reload/reopen + # the project and update the navigation tree. + if CurrentTabItem().filename === project then updateproject() - handle_update() - } + handle_update() + } end # @@ -353,14 +353,14 @@ $endif chdir(c.filedirectory) l := CurrentEditBox().get_contents() | [] ufile := open(c.filename, "cu") | { - \uidlog.MsgBox.set_contents([c.filename || - ": failure to open for writing."]) - fail - } + \uidlog.MsgBox.set_contents([c.filename || + ": failure to open for writing."]) + fail + } # write the lines to the file, with at most one carriage return every write(ufile,trim(!l,'\^m'), - if \linebreak=="CRLF" then "\^m" else "") + if \linebreak=="CRLF" then "\^m" else "") close(ufile) \uidlog.MsgBox.set_contents([c.label || " saved."]) @@ -369,7 +369,7 @@ $endif # update (i.e. re-populate the navigation tree) from it. if map(c.label[-4:0]) == ".icp" then updateproject() uidlog.FileBrowser.addreplace(CurrentEditBox().get_contents(), - uidlog.FileTabSet.which_one.filename, 0) + uidlog.FileTabSet.which_one.filename, 0) handle_update() modified := &null return @@ -403,17 +403,17 @@ $endif # Replaces a simpler function in editabletextlist.icn local L, startcol, i, j, whichFindFunction := find, direction, - foundline, foundcol, rd + foundline, foundcol, rd # override the find function if there are special requests if rd := \uidlog.menubar.replace_dialog then { - if \rd.check_box_insensitive.is_checked_flag then { - whichFindFunction := c_find - } - else if \rd.check_box_regex.is_checked_flag then { - whichFindFunction := findre - } - } + if \rd.check_box_insensitive.is_checked_flag then { + whichFindFunction := c_find + } + else if \rd.check_box_regex.is_checked_flag then { + whichFindFunction := findre + } + } # find something L := CurrentEditBox().get_contents() @@ -457,16 +457,16 @@ $endif oldwindow := &window &window := &null if TextDialog(["Go to line# : "],gotoln,1)=="Okay" then { - gotoln := integer(dialog_value[1]) - ide.goto_line(gotoln,1) - } + gotoln := integer(dialog_value[1]) + ide.goto_line(gotoln,1) + } &window := oldwindow end method goto_line(ln,cn) if not (CurrentEditBox().goto_line(ln,cn)) then { - uidlog.MsgBox.set_contents(["nonexistent line number " || ln]) - } + uidlog.MsgBox.set_contents(["nonexistent line number " || ln]) + } end # @@ -509,11 +509,11 @@ $endif local command, str, compile_options, log1, cmd, fname, arglist, fdir static compile_cmd initial { - if &features=="MS Windows NT" then - compile_cmd := "wunicon -c -quiet -log " - else - compile_cmd := "unicon -c " - } + if &features=="MS Windows NT" then + compile_cmd := "wunicon -c -quiet -log " + else + compile_cmd := "unicon -c " + } /targs := "" /arglist := "" fdir := chdir(CurrentTabItem().filedirectory) @@ -521,20 +521,20 @@ $endif lst := [] if CurrentTabItem().label ==="Untitled" then { - \uidlog.MsgBox.set_contents(["Open a file to compile "]) - return - } + \uidlog.MsgBox.set_contents(["Open a file to compile "]) + return + } \(CurrentTabItem().filename) | fail fname:= "\"" || CurrentTabItem().filename || "\"" if /is_MSWindows then - cmd := compile_cmd || targs || " " ||comp1file(fname)|| " > "||wiconlog||" 2>&1" + cmd := compile_cmd || targs || " " ||comp1file(fname)|| " > "||wiconlog||" 2>&1" else - cmd := compile_cmd || wiconlog ||" "||targs|| " "||comp1file(fname) + cmd := compile_cmd || wiconlog ||" "||targs|| " "||comp1file(fname) if find(".icn",fname) then - system( cmd, lst,1 ,comp1file(fname)) + system( cmd, lst,1 ,comp1file(fname)) fileCompiled := "TRUE" showanyerror(wiconlog, lst) end @@ -545,9 +545,9 @@ $endif local extended if s[1]==s[-1]=="\"" then s := s[2:-1] # de-quote if needed if find(".icn", CurrentTabItem().label) then { - s[find(".icn", map(s)) : 0] := "" # truncate extension - extended := s || ".icn" - } + s[find(".icn", map(s)) : 0] := "" # truncate extension + extended := s || ".icn" + } return quotes(extended) end @@ -573,20 +573,20 @@ $endif local L, cmd, s, fdir, fname, cmd2, console, fun, unam, scpt if /fileset := set() then { - if fun := open(".") then { - every insert(fileset, !fun) - close(fun) - fun := &null - } + if fun := open(".") then { + every insert(fileset, !fun) + close(fun) + fun := &null + } } # # Before you run it, make the executable. # This will save it if it is modified. on_makeexe_btn() - if \(CurrentTabItem().filedirectory) & + if \(CurrentTabItem().filedirectory) & CurrentTabItem().filedirectory ~== "" then - fdir := chdir(CurrentTabItem().filedirectory) + fdir := chdir(CurrentTabItem().filedirectory) else fdir := chdir(".") fname := CurrentTabItem().filename @@ -618,14 +618,14 @@ $endif scpt := " " } # using script is currently hit-and-miss 09/23/14 - + # path search for local terminal, use it if pathfind("xterm", getenv("PATH")) then { if (fun := open("uname","pr")) & # Apple xterm option (unam := read(fun)) & close(fun) & match("Darwin",unam) then { console := "xterm -hold -e script " || wiconlog ||" " cmd2 := console || \cmd || " " - } + } else { # non-Apple xterm console := "xterm -hold -e script -c \"" cmd2 := console || \cmd || " \" " || wiconlog @@ -633,24 +633,24 @@ $endif } else if pathfind("konsole", getenv("PATH")) then { console := "konsole --vt_sz 70x18 " - cmd2 := console || \cmd || " &> " || wiconlog + cmd2 := console || \cmd || " &> " || wiconlog } else if pathfind("mate-terminal", getenv("PATH")) then { console := "mate-terminal -e " - cmd2 := console || \cmd || " &> " || wiconlog + cmd2 := console || \cmd || " &> " || wiconlog } else if pathfind("gnome-terminal", getenv("PATH")) then { console := "gnome-terminal -- " - cmd2 := console || \cmd || " &> " || wiconlog + cmd2 := console || \cmd || " &> " || wiconlog } else if pathfind("lxterminal", getenv("PATH")) then { console := "lxterminal -e " - cmd2 := console || \cmd || " &> " || wiconlog + cmd2 := console || \cmd || " &> " || wiconlog } else if pathfind("xfce4-terminal", getenv("PATH")) then { console := "xfce4-terminal --hold -e " - cmd2 := console || \cmd || " &> " || wiconlog - } + cmd2 := console || \cmd || " &> " || wiconlog + } else #just run without "console || ..." cmd2 := \cmd || " &> " || wiconlog } @@ -662,10 +662,10 @@ $endif if find(".icn", CurrentTabItem().label) then cmd2 := "wiconx -l" || wiconlog || " " || quotes(fdir || cmd) } - + uidlog.MsgBox.set_contents(["Launching the program in its own window.", - "Finish the run and close that window to return to the IDE." - ]) + "Finish the run and close that window to return to the IDE." + ]) uidlog.MsgBox.refresh() uidlog.MsgBox.display() @@ -682,7 +682,7 @@ $endif showanyerror(s, [], 0) } end - + method CurrentDevBox() local ti ti := CurrentDevItem() | stop ("No Current DevTabItem") @@ -718,7 +718,7 @@ $endif } if \is_MSWindows then - (\args2) ||:= ".exe" + (\args2) ||:= ".exe" # finds the path to udb $ifdef _UNIX @@ -732,7 +732,7 @@ $endif if \args2 then { if /filedirectory then filedirectory := chdir() - + pth := udbprefix || pth || " -line" pth ||:= " "||filedirectory|| PATHSEP || args2 @@ -748,8 +748,8 @@ $endif } else { uidlog.MsgBox.set_contents( uidlog.MsgBox.get_contents() ||| - ["UDB not found"]) - } + ["UDB not found"]) + } handle_update() chdir(cwd) end @@ -781,7 +781,7 @@ $endif } } showanyerror(wiconlog, dlst) - + uidlog.MsgBox.goto_line(*dlst,1) end @@ -791,45 +791,45 @@ $endif method handle_openproject(ev, projectname, fname) local line, nchars, fd, file, found, which_tab, fin, tab_id, c if /projectname then { - if /is_MSWindows then { - fd := HFileDialog() - fd.show_modal() - projectname := fd.get_result() | fail - filedirectory := fd.get_directory() - } - else - projectname := WinOpenDialog(&window, "Open Project ...", "", 50) | - fail - } + if /is_MSWindows then { + fd := HFileDialog() + fd.show_modal() + projectname := fd.get_result() | fail + filedirectory := fd.get_directory() + } + else + projectname := WinOpenDialog(&window, "Open Project ...", "", 50) | + fail + } if /projectname | projectname=="" | projectname[-1]==("\\"|"/") then { - uidlog.MsgBox.set_contents(["Enter Project Name"]) - } + uidlog.MsgBox.set_contents(["Enter Project Name"]) + } if map(projectname)[-4:0] == ".icp" then { # open project - project := projectname - updateproject() - } + project := projectname + updateproject() + } if projectname[-2:0] == ".*" then projectname := projectname[1:-2] file := open(projectname, "ru") | { - \uidlog.MsgBox.set_contents(["Could not open project: " || - \projectname]) - return - } + \uidlog.MsgBox.set_contents(["Could not open project: " || + \projectname]) + return + } tab_label := fname found := 1 file_contents := [] nchars := 0 while line := read(file) do { - if line[-1] == "\^m" then line := line[1:-1] - put(file_contents, line) - nchars +:= *line + 1 - } + if line[-1] == "\^m" then line := line[1:-1] + put(file_contents, line) + nchars +:= *line + 1 + } # We don't have a files open with the same name, so # add a new tab with the file name # if opened_files_num === 0 then { new_project_tabitem(,1,file_name(projectname),file_contents) \uidlog.MsgBox.set_contents(["opened " || projectname || ", " || - *file_contents ||" lines, " || nchars || " characters"]) + *file_contents ||" lines, " || nchars || " characters"]) CurrentTabItem().set_label(tab_label) uidlog.FileTabSet.set_which_one(CurrentTabItem()) handle_update() @@ -857,37 +857,37 @@ $endif chdir(CurrentTabItem().filedirectory) if /is_MSWindows then { - fd := HFileDialog() - fd.show_modal() - fd.set_attribs("label=Save Project As:") - #fd.set_extra_attribs(["label=Save file As:"]) - filename := fd.get_result() | fail - } + fd := HFileDialog() + fd.show_modal() + fd.set_attribs("label=Save Project As:") + #fd.set_extra_attribs(["label=Save file As:"]) + filename := fd.get_result() | fail + } else { - filename := WinSaveDialog(&window, "Save Project As:", "", 50, - "Unicon Project (.prj)|*.prj|_ - Unicon Source File (.icn)|*.icn|_ - All Files(*.*)|*.*|",0,chdir()) | fail - if filename[-2:0] == ".*" then filename[-2:0] := "" - } + filename := WinSaveDialog(&window, "Save Project As:", "", 50, + "Unicon Project (.prj)|*.prj|_ + Unicon Source File (.icn)|*.icn|_ + All Files(*.*)|*.*|",0,chdir()) | fail + if filename[-2:0] == ".*" then filename[-2:0] := "" + } numfiles +:= 1 if /filename | filename=="" | filename[-1]==("\\"|"/") then { - uidlog.MsgBox.set_contents(["Enter project name to save"]) - return - } + uidlog.MsgBox.set_contents(["Enter project name to save"]) + return + } if \project then { - # Resolve absolute versus relative paths and not add absolute - # if relative is already in the project. - # Brute force version in place. - if (not find(map(filename), map(("" | (chdir() || PATHSEP)) || - (!menu_1.menus).get_label()))) & find(".icn"|".u",filename) then { - foo := TextMenuItem() - foo.set_label(filename) - menu_1.add(foo) - self.resize() # recalc with new components in place - } - } + # Resolve absolute versus relative paths and not add absolute + # if relative is already in the project. + # Brute force version in place. + if (not find(map(filename), map(("" | (chdir() || PATHSEP)) || + (!menu_1.menus).get_label()))) & find(".icn"|".u",filename) then { + foo := TextMenuItem() + foo.set_label(filename) + menu_1.add(foo) + self.resize() # recalc with new components in place + } + } return filename end @@ -900,14 +900,14 @@ $endif icodename := project icodename[find(".icp", map(icodename)) : 0] := "" if f := open(project) then { - while s := trim(read(f), '\^m') do { - foo := TextMenuItem() - foo.set_label(s) - menu_1.add(foo) - self.resize() # recalc with new components in place - } - close(f) - } + while s := trim(read(f), '\^m') do { + foo := TextMenuItem() + foo.set_label(s) + menu_1.add(foo) + self.resize() # recalc with new components in place + } + close(f) + } end # @@ -924,97 +924,97 @@ $endif # method complink() local x, arglist := "", lst := [], logf, i, s, fname, file_name, - cmd, cmdargs, fdir + cmd, cmdargs, fdir static compile_cmd initial { - if &features=="MS Windows NT" then - compile_cmd := "wunicon -quiet -log " - else - compile_cmd := "unicon " - } + if &features=="MS Windows NT" then + compile_cmd := "wunicon -quiet -log " + else + compile_cmd := "unicon " + } /targs := "" lst := [] if find(".",CurrentTabItem().label) then { - if \modified == 1 then { - save_file(CurrentTabItem()) - } - } + if \modified == 1 then { + save_file(CurrentTabItem()) + } + } else { - on_saveas_btn() - } + on_saveas_btn() + } fdir := chdir(CurrentTabItem().filedirectory) if /project then { - if not (arglist := comp1file(\CurrentTabItem().filename)) then { - s := \CurrentTabItem().filename + if not (arglist := comp1file(\CurrentTabItem().filename)) then { + s := \CurrentTabItem().filename if /s then{ fileCompiled := "FALSE" fail } - if find(".icn", map(s)) then { - s[find(".icn", map(s)) : 0] := ".u" - if s[1] ~== "-" & (not find(".", s)) then s ||:= ".u" - } - arglist := quotes(s) - } - icodename := CurrentTabItem().filename - if find(".icn", map(icodename)) then - icodename[find(".icn", map(icodename)) : 0] := "" - } + if find(".icn", map(s)) then { + s[find(".icn", map(s)) : 0] := ".u" + if s[1] ~== "-" & (not find(".", s)) then s ||:= ".u" + } + arglist := quotes(s) + } + icodename := CurrentTabItem().filename + if find(".icn", map(icodename)) then + icodename[find(".icn", map(icodename)) : 0] := "" + } else { - # compile all project sources that need it (in one step) - # this part is untested under ui.icn yet - arglist := "" - i := 1 - while menu_1.menus[i].get_label() ~== "Exit" do i +:= 1 - i +:= 1 - while menu_1.menus[i] do { - if arglist ||:= comp1file(menu_1.menus[i].get_label()) then - arglist ||:= " " - i +:= 1 - } - - if find(".icn",\arglist) then { - if /is_MSWindows then - cmdargs := " " || targs || " " || arglist || " > " || - wiconlog || " 2>&1" - else - cmdargs := " " || wiconlog || " " || targs || " " || arglist - - system( compile_cmd || "-c" || cmdargs , lst,1, "Compiling...") - showanyerror(wiconlog, lst) - } - - # build a list of all the files to be linked together - arglist := "" - i := 1 - while menu_1.menus[i].get_label() ~== "Exit" do i +:= 1 - i +:= 1 - while menu_1.menus[i] do { - s := menu_1.menus[i].get_label() - s[find(".icn", map(s)) : 0] := ".u" - if s[1] ~== "-" & (not find(".", s)) & find(".icn", map(s)) then - s ||:= ".u" - arglist ||:= quotes(s) || " " - i +:= 1 - } - } + # compile all project sources that need it (in one step) + # this part is untested under ui.icn yet + arglist := "" + i := 1 + while menu_1.menus[i].get_label() ~== "Exit" do i +:= 1 + i +:= 1 + while menu_1.menus[i] do { + if arglist ||:= comp1file(menu_1.menus[i].get_label()) then + arglist ||:= " " + i +:= 1 + } + + if find(".icn",\arglist) then { + if /is_MSWindows then + cmdargs := " " || targs || " " || arglist || " > " || + wiconlog || " 2>&1" + else + cmdargs := " " || wiconlog || " " || targs || " " || arglist + + system( compile_cmd || "-c" || cmdargs , lst,1, "Compiling...") + showanyerror(wiconlog, lst) + } + + # build a list of all the files to be linked together + arglist := "" + i := 1 + while menu_1.menus[i].get_label() ~== "Exit" do i +:= 1 + i +:= 1 + while menu_1.menus[i] do { + s := menu_1.menus[i].get_label() + s[find(".icn", map(s)) : 0] := ".u" + if s[1] ~== "-" & (not find(".", s)) & find(".icn", map(s)) then + s ||:= ".u" + arglist ||:= quotes(s) || " " + i +:= 1 + } + } if find(".icn",CurrentTabItem().label) then { if /is_MSWindows then { cmdargs := " " || targs || " " || arglist || " > " ||wiconlog||" 2>&1" - cmd := compile_cmd || "-o " || quotes(icodename) || cmdargs - } + cmd := compile_cmd || "-o " || quotes(icodename) || cmdargs + } else { - cmdargs := " " || wiconlog || " " || targs || " " || arglist - cmd := compile_cmd || cmdargs - } + cmdargs := " " || wiconlog || " " || targs || " " || arglist + cmd := compile_cmd || cmdargs + } system( cmd, lst,1,"Compiling...") showanyerror(wiconlog, lst) } else { - \uidlog.MsgBox.set_contents(["UI only compiles .icn files"]) + \uidlog.MsgBox.set_contents(["UI only compiles .icn files"]) } fileCompiled := "TRUE" @@ -1026,7 +1026,7 @@ $endif method on_error_check(ev) errLine := "FALSE" if fileCompiled === "TRUE" then - GotoErrorLine(errors_list) + GotoErrorLine(errors_list) end # @@ -1038,35 +1038,35 @@ $endif local log1, i, s, ln, nerrors := 0 #delay(800) if log1 := open(fn, "r") then { - while put(\lst, read(log1)) - close(log1) - remove(fn) - every s := !lst do { - if find(CurrentTabItem().label||":", s) then - nerrors +:= 1 - } - if find(".icn",CurrentTabItem().label) & nerrors > 0 then - nerrors -:= 1 - \uidlog.MsgBox.set_contents(lst) - if ( \ (uidlog.MsgBox.vsb)).set_value(*lst - uidlog.MsgBox.vsb.page_size) then - uidlog.MsgBox.refresh() - every s := !lst do s ? { - if (not match("Script")) & - (fn := ((tab(any(&letters))||=":")|"") || - tab(many(&letters++&digits++' .\\/-'))) & =":" & - ln := integer(tab(many(&digits))) & = ":" then { - if CurrentTabItem().label ~=== fn then - handle_openfile( , fn) - goto_line(ln,1) - CurrentEditBox().highlight_line(ln) - return - } - } - } + while put(\lst, read(log1)) + close(log1) + remove(fn) + every s := !lst do { + if find(CurrentTabItem().label||":", s) then + nerrors +:= 1 + } + if find(".icn",CurrentTabItem().label) & nerrors > 0 then + nerrors -:= 1 + \uidlog.MsgBox.set_contents(lst) + if ( \ (uidlog.MsgBox.vsb)).set_value(*lst - uidlog.MsgBox.vsb.page_size) then + uidlog.MsgBox.refresh() + every s := !lst do s ? { + if (not match("Script")) & + (fn := ((tab(any(&letters))||=":")|"") || + tab(many(&letters++&digits++' .\\/-'))) & =":" & + ln := integer(tab(many(&digits))) & = ":" then { + if CurrentTabItem().label ~=== fn then + handle_openfile( , fn) + goto_line(ln,1) + CurrentEditBox().highlight_line(ln) + return + } + } + } else { - put(lst, "Can't open logfile " || \fn || ": " || \i) - uidlog.MsgBox.set_contents(lst) - } + put(lst, "Can't open logfile " || \fn || ": " || \i) + uidlog.MsgBox.set_contents(lst) + } end # @@ -1076,35 +1076,35 @@ $endif # method GotoErrorLine(errors_list) local curLine, fileBase, cLineNum, ix, index, fn, ln, - errmessage + errmessage index := uidlog.MsgBox.get_cursor() curLine := \lst[\index] if ( \ (uidlog.MsgBox.vsb)).set_value(*lst - uidlog.MsgBox.vsb.page_size) then - \uidlog.MsgBox.refresh() + \uidlog.MsgBox.refresh() \curLine ? { - if ((fn:=((tab(any(&letters))||=":")|"")|| - tab(many(&letters++&digits++' .\\/-'))) & - = ":" & ln := integer(tab(many(&digits))) &= ":") then { - errLine := "TRUE" - if map(fn) ~== map(\tab_label) then { - handle_openfile( , fn) - uidlog.set_focus(CurrentEditBox()) - } - goto_line(ln,1) - } + if ((fn:=((tab(any(&letters))||=":")|"")|| + tab(many(&letters++&digits++' .\\/-'))) & + = ":" & ln := integer(tab(many(&digits))) &= ":") then { + errLine := "TRUE" + if map(fn) ~== map(\tab_label) then { + handle_openfile( , fn) + uidlog.set_focus(CurrentEditBox()) + } + goto_line(ln,1) + } } if errLine == "TRUE" then { - CurrentEditBox().highlight_line(ln) - return - } + CurrentEditBox().highlight_line(ln) + return + } else { - errmessage := &window - &window := &null - Notice("Selected line is not a unicon error message.") - &window := errmessage - } + errmessage := &window + &window := &null + Notice("Selected line is not a unicon error message.") + &window := errmessage + } end # @@ -1161,13 +1161,13 @@ $endif # toggles backwards search and shifts focus to the textfield uidlog.set_focus(text_field_search) if /self.toggle_find_dir_btn.is_checked_flag then { - # Right Arrow / Search Forwards Image - toggle_find_dir_btn.set_img("16,c1,554>>54>>555555555464546)555555555454446)<555555544>4>>4>>555555546<>V)6<)555555546<)v)6<)5555554>>>>v>4>>)55555>56<>5><54v55555>56<>5)(54v55555>vvvv5vvvvv55555555555555555555555555555555SS55555555555555SSS55555SSSSSSSSSSSS555555555555SSS5555555555555SS555") - } + # Right Arrow / Search Forwards Image + toggle_find_dir_btn.set_img("16,c1,554>>54>>555555555464546)555555555454446)<555555544>4>>4>>555555546<>V)6<)555555546<)v)6<)5555554>>>>v>4>>)55555>56<>5><54v55555>56<>5)(54v55555>vvvv5vvvvv55555555555555555555555555555555SS55555555555555SSS55555SSSSSSSSSSSS555555555555SSS5555555555555SS555") + } else { - # Left Arrow / Search Backwards Image - toggle_find_dir_btn.set_img("16,c1,554>>54>>555555555464546)555555555454446)<555555544>4>>4>>555555546<>V)6<)555555546<)v)6<)5555554>>>>v>4>>)55555>56<>5><54v55555>56<>5)(54v55555>vvvv5vvvvv555555555555555555555555SS5555555555555SSS555555555555SSSSSSSSSSSS55555SSS55555555555555SS55555555555") - } + # Left Arrow / Search Backwards Image + toggle_find_dir_btn.set_img("16,c1,554>>54>>555555555464546)555555555454446)<555555544>4>>4>>555555546<>V)6<)555555546<)v)6<)5555554>>>>v>4>>)55555>56<>5><54v55555>56<>5)(54v55555>vvvv5vvvvv555555555555555555555555SS5555555555555SSS555555555555SSSSSSSSSSSS55555SSS55555555555555SS55555555555") + } end # @@ -1215,29 +1215,29 @@ $endif local tab_item_new, EditBox tab_item_new := BufferTabItem() if x == 1 then { - if filename === "" then { - uidlog.MsgBox.set_contents(["No File Name Specified..."]) - } - else { - tab_item_new.set_label(filename) + if filename === "" then { + uidlog.MsgBox.set_contents(["No File Name Specified..."]) + } + else { + tab_item_new.set_label(filename) tab_item_new.filedirectory := CurrentTabItem().filedirectory - } - } + } + } else { - filename := "Untitled" - tab_item_new.set_label(filename) + filename := "Untitled" + tab_item_new.set_label(filename) tab_item_new.filename := filename tab_item_new.filedirectory := CurrentTabItem().filedirectory - } + } if map(\filename)[-4:0] == ".icn" then - EditBox := BuffEditableTextList() + EditBox := BuffEditableTextList() else - EditBox := EditableTextList() + EditBox := EditableTextList() EditBox.set_pos("2", "2") EditBox.set_size("100%-4", "100%-4") EditBox.set_attribs("bg="||uidlog.ui_Preferences.val_background_color, - "font="||fontname) + "font="||fontname) EditBox.set_contents(file_contents) tab_item_new.add(EditBox) @@ -1260,19 +1260,19 @@ $endif local tab_item_new, nullfilename tab_item_new := BufferTabItem() if x == 1 then { - if filename === "" then { - nullfilename := &window - &window := &null - Notice("Enter File Name ...") - &window := nullfilename - } - else tab_item_new.set_label(filename) - } + if filename === "" then { + nullfilename := &window + &window := &null + Notice("Enter File Name ...") + &window := nullfilename + } + else tab_item_new.set_label(filename) + } else { - if filename === "" then - tab_item_new.set_label("Untitled") - else tab_item_new.set_label(filename) - } + if filename === "" then + tab_item_new.set_label("Untitled") + else tab_item_new.set_label(filename) + } uidlog.EditBox := BuffEditableTextList() uidlog.EditBox.set_pos("2", "2") @@ -1298,14 +1298,14 @@ $endif method on_ivib(ev) local L := [] if CurrentTabItem().label==="Untitled" then { - system("ivib " || \tab_label, L) | uidlog.MsgBox.set_contents(L) - handle_closefile() - handle_openfile( , tab_label) - } + system("ivib " || \tab_label, L) | uidlog.MsgBox.set_contents(L) + handle_closefile() + handle_openfile( , tab_label) + } else { - if not system("ivib " || CurrentTabItem().label, L) then + if not system("ivib " || CurrentTabItem().label, L) then uidlog.MsgBox.set_contents(["System Failed"]) - } + } end # @@ -1530,11 +1530,11 @@ $endif # method save() if CurrentTabItem().label == ("Untitled"|"scratch") then { - saveas() - } + saveas() + } else { - save_file(CurrentTabItem().label) - } + save_file(CurrentTabItem().label) + } modified := &null end # @@ -1542,7 +1542,7 @@ $endif # method saveas(ev) local fd, filename, foo, index := i, warntxt, fexist := &null, L, - i, oldwindow, win, fileslist, fext + i, oldwindow, win, fileslist, fext chdir(CurrentTabItem().filedirectory) @@ -1550,69 +1550,69 @@ $endif every put(fileslist,!open(".")) if /is_MSWindows then { - fd := HFileDialog() - fd.set_attribs("label=Save File As:") - fd.show_modal() - #fd.set_extra_attribs(["label=Save file As:"]) - filename := fd.get_result() | fail - filedirectory := fd.get_directory() + fd := HFileDialog() + fd.set_attribs("label=Save File As:") + fd.show_modal() + #fd.set_extra_attribs(["label=Save file As:"]) + filename := fd.get_result() | fail + filedirectory := fd.get_directory() # Append .icn under certain circumstances. Probably need to fix # circumstances. fext := fd.file_extension if (not find(".", file_name(filename))) & - find("Unicon Files", fext.selection_list[fext.get_selection()]) + find("Unicon Files", fext.selection_list[fext.get_selection()]) then - filename ||:= ".icn" + filename ||:= ".icn" - } + } else { - filename := WinSaveDialog(&window, "Save File As:", "", 50, - "Unicon Source File (.icn)|*.icn|_ - All Files(*.*)|*.*|",0,chdir()) | fail - if filename[-2:0] == ".*" then filename[-2:0] := ".icn" - } + filename := WinSaveDialog(&window, "Save File As:", "", 50, + "Unicon Source File (.icn)|*.icn|_ + All Files(*.*)|*.*|",0,chdir()) | fail + if filename[-2:0] == ".*" then filename[-2:0] := ".icn" + } if /filename | filename=="" | filename[-1]==("\\"|"/") then { - \uidlog.MsgBox.set_contents(["Enter file name to save"]) - return - } + \uidlog.MsgBox.set_contents(["Enter file name to save"]) + return + } every i := 1 to *fileslist do - if file_name(filename) === fileslist[i] then { - oldwindow := &window - &window := win - warntxt := UpdatedTextDialog ( - "Overwrite file? ","A file named "||file_name(filename)|| - " already exists. Are you sure you want to overwrite it?") - warntxt.show_modal() - &window := oldwindow - fexist := 1 - } + if file_name(filename) === fileslist[i] then { + oldwindow := &window + &window := win + warntxt := UpdatedTextDialog ( + "Overwrite file? ","A file named "||file_name(filename)|| + " already exists. Are you sure you want to overwrite it?") + warntxt.show_modal() + &window := oldwindow + fexist := 1 + } if (overwrite === "OK") | /fexist then { - if \project then { - # Resolve absolute versus relative paths and not add absolute - # if relative is already in the project. - # Brute force version in place. - if (not find(map(filename), map(("" | (chdir() || PATHSEP)) || - (!menu_1.menus).get_label()))) & - find(".icn"|".u",filename) then { - foo := TextMenuItem() - foo.set_label(filename) - menu_1.add(foo) - self.resize() # recalc with new components in place - } - } - uidlog.FileBrowser.nodereplace(CurrentTabItem().label) - CurrentTabItem().set_label(file_name(filename)) - L := CurrentEditBox().get_contents() | [] - uidlog.FileBrowser.addreplace(L, file_name(filename), 0) - save_file(filename) - if find(".icp", map(filename)) then { # open project - project := filename - updateproject() - } - handle_update() - } + if \project then { + # Resolve absolute versus relative paths and not add absolute + # if relative is already in the project. + # Brute force version in place. + if (not find(map(filename), map(("" | (chdir() || PATHSEP)) || + (!menu_1.menus).get_label()))) & + find(".icn"|".u",filename) then { + foo := TextMenuItem() + foo.set_label(filename) + menu_1.add(foo) + self.resize() # recalc with new components in place + } + } + uidlog.FileBrowser.nodereplace(CurrentTabItem().label) + CurrentTabItem().set_label(file_name(filename)) + L := CurrentEditBox().get_contents() | [] + uidlog.FileBrowser.addreplace(L, file_name(filename), 0) + save_file(filename) + if find(".icp", map(filename)) then { # open project + project := filename + updateproject() + } + handle_update() + } end # @@ -1632,7 +1632,7 @@ class UpdatedTextDialog : Dialog(caption,message) method component_setup() local l, bn1, bn2 l := Label("label="||message,"pos=50%,33%","size=100%,20%", - "align=c,c","internal_alignment=c") + "align=c,c","internal_alignment=c") add(l) bn1 := TextButton("label=OK","pos=45%,66%","size=60,30","align=c,c") @@ -1643,7 +1643,7 @@ class UpdatedTextDialog : Dialog(caption,message) add(bn1) add(bn2) attrib("label="||caption, "size=460,150", "bg=light gray", - "font=serif", "resize=on") + "font=serif", "resize=on") end method on_ok() overwrite := "OK" diff --git a/uni/ide/ivib/attribtab.icn b/uni/ide/ivib/attribtab.icn index e16c422c3..5e72e6787 100644 --- a/uni/ide/ivib/attribtab.icn +++ b/uni/ide/ivib/attribtab.icn @@ -12,14 +12,14 @@ import lang $include "guih.icn" class AttribTab : TabItem( - tbl, - add, # Buttons - delete, # - apply, # - contents, # Table contents - attrib, - value - ) + tbl, + add, # Buttons + delete, # + apply, # + contents, # Table contents + attrib, + value + ) method on_add() # @@ -45,18 +45,18 @@ class AttribTab : TabItem( # Line in the table clicked - copy the line to the edit area. # if i := tbl.get_selections()[1] then { - attrib.set_contents(contents[i][1]) - value.set_contents(contents[i][2]) - attrib.clear_is_shaded() - value.clear_is_shaded() - delete.clear_is_shaded() - apply.clear_is_shaded() - } + attrib.set_contents(contents[i][1]) + value.set_contents(contents[i][2]) + attrib.clear_is_shaded() + value.clear_is_shaded() + delete.clear_is_shaded() + apply.clear_is_shaded() + } else { - attrib.set_is_shaded() - value.set_is_shaded() - delete.set_is_shaded() - apply.set_is_shaded() + attrib.set_is_shaded() + value.set_is_shaded() + delete.set_is_shaded() + apply.set_is_shaded() } end diff --git a/uni/ide/ivib/canvas.icn b/uni/ide/ivib/canvas.icn index 05eb16f4a..92edb524b 100644 --- a/uni/ide/ivib/canvas.icn +++ b/uni/ide/ivib/canvas.icn @@ -18,7 +18,7 @@ $include "guih.icn" # # Length of resize line at bottom right corner -$define RSW 12 +$define RSW 12 # Width of the border around the Canvas. $define EDGE 4 @@ -57,7 +57,7 @@ class Canvas : Component : SelectiveClassCoding( orig_w, orig_h, orig_x_spec, # Original pos/size spec of an item being - orig_y_spec, # resized/moved + orig_y_spec, # resized/moved orig_w_spec, orig_h_spec, x_new, # New pos/size spec of an item being resized/moved @@ -115,9 +115,9 @@ class Canvas : Component : SelectiveClassCoding( method update_pos_label() if \self.selected then self.parent_dialog.pos_label.set_label(self.selected.x_spec || "," || - self.selected.y_spec || " : " || - self.selected.w_spec || "," || - self.selected.h_spec) + self.selected.y_spec || " : " || + self.selected.w_spec || "," || + self.selected.h_spec) else self.parent_dialog.pos_label.set_label("") end @@ -208,8 +208,8 @@ class Canvas : Component : SelectiveClassCoding( every t := !selections do { c := t.cp() # - # Set pos of new object. - # + # Set pos of new object. + # c.w := t.w c.h := t.h c.x_spec := c.get_x_alignment_offset() + 10 + 7 * (copy_count % 4) + t.x - t.parent.get_x_reference() @@ -490,7 +490,7 @@ class Canvas : Component : SelectiveClassCoding( self.update_pos_label() self.invalidate() end - + # # Even-space the selections horizontally. # @@ -501,7 +501,7 @@ class Canvas : Component : SelectiveClassCoding( self.parent_dialog.push_undo() - if *self.selections = 1 then + if *self.selections = 1 then return # @@ -535,7 +535,7 @@ class Canvas : Component : SelectiveClassCoding( self.parent_dialog.push_undo() - if *self.selections = 1 then + if *self.selections = 1 then return # @@ -634,7 +634,7 @@ class Canvas : Component : SelectiveClassCoding( cn ||:= "_" || (name_table[cn] +:= 1) return cn - end + end # # Generate code output (see also code.iol). @@ -672,7 +672,7 @@ class Canvas : Component : SelectiveClassCoding( return c end - + # # Minimum width of canvas. # @@ -688,7 +688,7 @@ class Canvas : Component : SelectiveClassCoding( end # - # Called if the canvas has been modified. + # Called if the canvas has been modified. # method set_modified() self.modified === 1 & return @@ -714,7 +714,7 @@ class Canvas : Component : SelectiveClassCoding( local star := if \self.modified then "*" else "" WAttrib(self.get_parent_win(), "label=Ivib: "||star||(\self.filename|"")) end - + # # Set the filename. # @@ -723,7 +723,7 @@ class Canvas : Component : SelectiveClassCoding( set_wTitle() self.parent_dialog.set_filename_label() end - + # # Reset fields to an original state. # @@ -817,7 +817,7 @@ class Canvas : Component : SelectiveClassCoding( c.event_handlers := copy(\self.event_handlers) c.set_pos(self.x, self.y) c.set_size(self.w, self.h) - # + # # Copy the items. # c.items := [] @@ -827,7 +827,7 @@ class Canvas : Component : SelectiveClassCoding( return c end - # + # # Open the preferences dialog. # method dialog() @@ -850,14 +850,14 @@ class Canvas : Component : SelectiveClassCoding( self.Component.resize() parent_dlg := self.get_parent_dialog() WAttrib(Canvas_temp_win, "size=" || parent_dlg.get_w_reference() - - self.x + 2 * EDGE || "," || parent_dlg.get_h_reference() - - self.y + 2 * EDGE) + self.x + 2 * EDGE || "," || parent_dlg.get_h_reference() - + self.y + 2 * EDGE) end # # Reset the cloned and buffer windows created by gui.iol to match the # Canvas's own attributes, rather than the program's. - # + # method reset_windows() local t1, t2 Uncouple(self.cwin) @@ -868,7 +868,7 @@ class Canvas : Component : SelectiveClassCoding( self.cbwin := (Clone ! ([t2] ||| self.dialog_struct.attribs)) Uncouple(t1) Uncouple(t2) - # + # # The above will change the main window's pointer if this attrib is set # in its attrib list; so reset the pointer to normal just in case it's # changed. @@ -891,31 +891,31 @@ class Canvas : Component : SelectiveClassCoding( # between right and bottom edge of canvas and edge of window. # EraseArea(parent.win, self.x + self.w + EDGE, self.y - EDGE, - parent.get_w_reference(), parent.get_h_reference()) + parent.get_w_reference(), parent.get_h_reference()) EraseArea(parent.win, self.x - EDGE, self.y + self.h + EDGE, - parent.get_w_reference(), parent.get_h_reference()) + parent.get_w_reference(), parent.get_h_reference()) clear_borders_flag := &null - } + } if \self.is_held then { - # + # # During a drag of a component # # - # Copy saved original to buffer. + # Copy saved original to buffer. # CopyArea(Canvas_temp_win, self.cbwin, - 0, 0, self.w, self.h, self.x, self.y) + 0, 0, self.w, self.h, self.x, self.y) # # Highlight moving object # moving.do_highlight(self.cbwin) # # Display from buffer. - # + # CopyArea(self.cbwin, self.cwin, - self.x, self.y, self.w, self.h, self.x, self.y) + self.x, self.y, self.w, self.h, self.x, self.y) } else if \self.is_resizing then { # @@ -926,25 +926,25 @@ class Canvas : Component : SelectiveClassCoding( # Copy saved original to buffer. # CopyArea(Canvas_temp_win, self.cbwin, 0, 0, - parent.get_w_reference() - self.x + 2 * EDGE, - parent.get_h_reference() - self.y + 2 * EDGE, - self.x - EDGE, self.y - EDGE) + parent.get_w_reference() - self.x + 2 * EDGE, + parent.get_h_reference() - self.y + 2 * EDGE, + self.x - EDGE, self.y - EDGE) # # Draw outline of new Canvas into buffer. # cw := Clone(self.cbwin, "linestyle=dashed") Rectangle(cw, self.x - EDGE, self.y - EDGE, - self.w + 2 * EDGE, self.h + 2 * EDGE) + self.w + 2 * EDGE, self.h + 2 * EDGE) Uncouple(cw) - + # # Copy buffer to display. # CopyArea(self.cbwin, self.cwin, self.x - EDGE, self.y - EDGE, - parent.get_w_reference() - self.x + 2 * EDGE, - parent.get_h_reference() - self.y + 2 * EDGE, - self.x - EDGE, self.y - EDGE) + parent.get_w_reference() - self.x + 2 * EDGE, + parent.get_h_reference() - self.y + 2 * EDGE, + self.x - EDGE, self.y - EDGE) } else { # @@ -972,15 +972,15 @@ class Canvas : Component : SelectiveClassCoding( WAttrib(cw, "fg=red") every i := 1 to EDGE do DrawLine(cw, self.x + self.w - 1 - RSW, self.y + self.h - 1 + i, - self.x + self.w - 1 + i, self.y + self.h - 1 + i, - self.x + self.w - 1 + i, self.y + self.h - 1 - RSW) + self.x + self.w - 1 + i, self.y + self.h - 1 + i, + self.x + self.w - 1 + i, self.y + self.h - 1 - RSW) Uncouple(cw) if /buffer_flag then CopyArea(self.cbwin, self.cwin, self.x - EDGE, self.y - EDGE, - self.w + 2 * EDGE, self.h + 2 * EDGE, self.x - EDGE, - self.y - EDGE) + self.w + 2 * EDGE, self.h + 2 * EDGE, self.x - EDGE, + self.y - EDGE) #self.update_pos_label() } end @@ -991,9 +991,9 @@ class Canvas : Component : SelectiveClassCoding( # method in_resize_corner() return ((self.x + self.w <= &x < self.x + self.w + EDGE) & - (self.y + self.h + EDGE - RSW <= &y < self.y + self.h + EDGE)) | + (self.y + self.h + EDGE - RSW <= &y < self.y + self.h + EDGE)) | ((self.x + self.w + EDGE - RSW <= &x < self.x + self.w + EDGE) & - (self.y + self.h <= &y < self.y + self.h + EDGE)) + (self.y + self.h <= &y < self.y + self.h + EDGE)) end # @@ -1001,11 +1001,11 @@ class Canvas : Component : SelectiveClassCoding( # method handle_event(e) if e === (Key_Up | Key_Down | Key_Left | Key_Right) then - handle_key_move(e) + handle_key_move(e) else { case e of { &lpress : handle_lpress() - &ldrag : handle_ldrag() + &ldrag : handle_ldrag() &lrelease : handle_lrelease() &rpress : handle_rpress() } @@ -1055,13 +1055,13 @@ class Canvas : Component : SelectiveClassCoding( if orig_w_spec ~== w_new then moving.w_default := &null - + if orig_h_spec ~== h_new then moving.h_default := &null - moving.set_pos(x_new, y_new) + moving.set_pos(x_new, y_new) moving.set_size(w_new, h_new) - moving.resize() + moving.resize() self.check_inside() self.update_pos_label() invalidate() @@ -1109,7 +1109,7 @@ class Canvas : Component : SelectiveClassCoding( y1 <:= orig_y + orig_h - (orig_h - moving.min_height()) / 2 h_new := orig_h + 2 * (y1 - (orig_y + orig_h)) } else if /moving.y_fixed | moving.y_align ~== "b" then { - y1 >:= self.y + self.h + y1 >:= self.y + self.h y1 <:= orig_y + moving.min_height() h_new := orig_h + (y1 - (orig_y + orig_h)) if moving.y_align == "b" then @@ -1125,7 +1125,7 @@ class Canvas : Component : SelectiveClassCoding( x1 <:= orig_x + orig_w - (orig_w - moving.min_width()) / 2 w_new := orig_w + 2 * (x1 - (orig_x + orig_w)) } else if /moving.x_fixed | moving.x_align ~== "r" then { - x1 >:= self.x + self.w + x1 >:= self.x + self.w x1 <:= orig_x + moving.min_width() w_new := orig_w + (x1 - (orig_x + orig_w)) if moving.x_align == "r" then @@ -1139,7 +1139,7 @@ class Canvas : Component : SelectiveClassCoding( if /moving.w_fixed then { if moving.x_align == "c" then { # - # x won't change; work out new width. + # x won't change; work out new width. # x1 <:= max(self.x, orig_x - (self.x + self.w - orig_x - orig_w)) x1 >:= orig_x + (orig_w - moving.min_width()) / 2 @@ -1176,7 +1176,7 @@ class Canvas : Component : SelectiveClassCoding( # Not in old container. Post a message. # self.parent_dialog.info_label.set_label(if obj === self then - "Placed back in canvas" else "Placed inside container") + "Placed back in canvas" else "Placed inside container") # # Take it out of the one it's currently in ... @@ -1186,8 +1186,8 @@ class Canvas : Component : SelectiveClassCoding( # # ... and put it in the new one. # - obj.place_inside(moving) - } + obj.place_inside(moving) + } end # @@ -1260,7 +1260,7 @@ class Canvas : Component : SelectiveClassCoding( WAttrib(self.get_parent_win(), "pointer=bottom right corner") self.drag_x_offset := &x - (moving.x + moving.w) self.drag_y_offset := &y - (moving.y + moving.h) - } + } # # Moving, not resizing. # @@ -1270,7 +1270,7 @@ class Canvas : Component : SelectiveClassCoding( self.drag_y_offset := &y - moving.y } } - + # # Save original pos and size. # @@ -1287,7 +1287,7 @@ class Canvas : Component : SelectiveClassCoding( # Copy present screen to Canvas_temp_win # CopyArea(self.cwin, Canvas_temp_win, - self.x, self.y, self.w, self.h, 0, 0) + self.x, self.y, self.w, self.h, 0, 0) } else if in_resize_corner() then { # # Save for possible push onto undo list. @@ -1314,9 +1314,9 @@ class Canvas : Component : SelectiveClassCoding( # Copy present screen to Canvas_temp_win # CopyArea(self.cwin, Canvas_temp_win, self.x - EDGE, self.y - EDGE, - self.get_parent_dialog().get_w_reference() -self.x + 2*EDGE, - self.get_parent_dialog().get_h_reference() - self.y + 2*EDGE, - 0, 0) + self.get_parent_dialog().get_w_reference() -self.x + 2*EDGE, + self.get_parent_dialog().get_h_reference() - self.y + 2*EDGE, + 0, 0) # # Set offsets. @@ -1358,7 +1358,7 @@ class Canvas : Component : SelectiveClassCoding( # # Calculate new x position and width - # + # case self.resize_mode of { # # Resizing x from left hand side of object. @@ -1374,22 +1374,22 @@ class Canvas : Component : SelectiveClassCoding( # Moving # default : move_horizontally(x1) - } + } # # Calculate new y position and height - # + # case self.resize_mode of { # # Resizing y from top of object. # 1 | 2 : resize_up(y1) - + # # Resizing y from bottom # 3 | 4 : resize_down(y1) - + # # Moving # @@ -1399,7 +1399,7 @@ class Canvas : Component : SelectiveClassCoding( # # Move the moving object to new position. # - moving.set_pos(x_new, y_new) + moving.set_pos(x_new, y_new) moving.set_size(w_new, h_new) moving.Component.resize() @@ -1441,19 +1441,19 @@ class Canvas : Component : SelectiveClassCoding( } end - # + # # Left button released. # method handle_lrelease() if \self.is_held then { if orig_x_spec ~== moving.x_spec | orig_y_spec ~== moving.y_spec | orig_w_spec ~== moving.w_spec | orig_h_spec ~== moving.h_spec then { - self.parent_dialog.push_onto_undo(self.tmp_dup) + self.parent_dialog.push_onto_undo(self.tmp_dup) self.set_modified() if orig_w_spec ~== moving.w_spec then moving.w_default := &null - + if orig_h_spec ~== moving.h_spec then moving.h_default := &null @@ -1471,7 +1471,7 @@ class Canvas : Component : SelectiveClassCoding( # Resizing or moving an object. # - # + # # Reset the pointer to normal. # WAttrib(self.get_parent_win(), "pointer=top left arrow") @@ -1487,11 +1487,11 @@ class Canvas : Component : SelectiveClassCoding( self.update_pos_label() self.invalidate() } else if \self.is_resizing then { - # + # # Finished resizing whole canvas. # - if orig_w ~= self.w | orig_h ~= self.h then { - self.parent_dialog.push_onto_undo(self.tmp_dup) + if orig_w ~= self.w | orig_h ~= self.h then { + self.parent_dialog.push_onto_undo(self.tmp_dup) self.set_modified() } @@ -1500,7 +1500,7 @@ class Canvas : Component : SelectiveClassCoding( # is_resizing := &null - # + # # Reset the pointer to normal. # WAttrib(self.get_parent_win(), "pointer=top left arrow") @@ -1511,7 +1511,7 @@ class Canvas : Component : SelectiveClassCoding( self.resize() every (!self.items).reset(self) - # + # # Redisplay after erasing any rubbish outside the new area # self.erase_and_display() @@ -1549,7 +1549,7 @@ class Canvas : Component : SelectiveClassCoding( end # - # Unfix the selected objects. + # Unfix the selected objects. # method unfix() local e @@ -1615,11 +1615,11 @@ class Canvas : Component : SelectiveClassCoding( method still_inside(c) end - # + # # Add c to the list of items. # method add(c) - put(items, c) + put(items, c) end # @@ -1671,7 +1671,7 @@ class Canvas : Component : SelectiveClassCoding( if /e.is_button_subclass then return alert_error("You can only have subclasses of Button _ in a CheckBoxGroup") - } + } self.parent_dialog.push_undo() @@ -1727,7 +1727,7 @@ class Canvas : Component : SelectiveClassCoding( self.parent_dialog.push_undo() # - # Create a new button group. + # Create a new button group. # n := button_groups.new() @@ -1767,7 +1767,7 @@ class Canvas : Component : SelectiveClassCoding( # - # Clear selections. + # Clear selections. # self.clear_selections() @@ -1779,7 +1779,7 @@ class Canvas : Component : SelectiveClassCoding( self.invalidate() end - initially + initially initial Canvas_temp_win := WOpen("canvas=hidden") @@ -1790,7 +1790,7 @@ end ############################################################################# # # Preferences for Canvas. -# +# class CanvasPreferencesDialog : CommonDialog( c, # The object being edited okay, # Okay button @@ -1821,12 +1821,12 @@ class CanvasPreferencesDialog : CommonDialog( # # Get the result - # + # method get_okay_result() return self.okay_result end - method on_set_min_w() + method on_set_min_w() min_w_spec.toggle_is_shaded() end @@ -1842,10 +1842,10 @@ class CanvasPreferencesDialog : CommonDialog( method on_has_ticker() text_ticker_rate.toggle_is_shaded() end - + method on_okay() local pair - # + # # Validate data # if set_min_w.is_checked() & not(integer(min_w_spec.get_contents())) then @@ -1853,7 +1853,7 @@ class CanvasPreferencesDialog : CommonDialog( if set_min_h.is_checked() & not(integer(min_h_spec.get_contents())) then return alert_error("Min height not integer") integer(self.gen_indent.get_contents()) | - return alert_error("Indent not integer") + return alert_error("Indent not integer") integer(w_spec.get_contents()) | return alert_error("Invalid width") integer(h_spec.get_contents()) | return alert_error("Invalid height") util_check_attribs(self, attrib_tab.get_contents()) | fail @@ -1880,7 +1880,7 @@ class CanvasPreferencesDialog : CommonDialog( c.gen_component_setup := if self.gen_component_setup.is_checked() then 1 else &null c.gen_init_dialog := if self.gen_init_dialog.is_checked() then 1 else &null c.gen_initially := if self.gen_initially.is_checked() then 1 else &null - c.gen_indent := integer(self.gen_indent.get_contents()) + c.gen_indent := integer(self.gen_indent.get_contents()) c.set_size(w_spec.get_contents(), h_spec.get_contents()) c.resize() c.reset_windows() @@ -1946,7 +1946,7 @@ class CanvasPreferencesDialog : CommonDialog( } else { min_h_spec.set_is_shaded() min_h_spec.set_contents(c.h) - } + } pos_tab.add(min_h_spec) l := Label() @@ -2040,7 +2040,7 @@ class CanvasPreferencesDialog : CommonDialog( gen_indent.set_align("l", "c") methods_tab.add(gen_indent) gen_indent.set_contents(c.gen_indent) - + code_tab := TabItem() code_tab.set_label("Code") tabset.add(code_tab) diff --git a/uni/ide/ivib/code.icn b/uni/ide/ivib/code.icn index 32a7b1489..4c81e71a8 100644 --- a/uni/ide/ivib/code.icn +++ b/uni/ide/ivib/code.icn @@ -18,13 +18,13 @@ record a_method(name, params, body) # Class to process code generation # class Code( - class_vars, # Class variables which have methods - local_vars, # Variables local to the setup method + class_vars, # Class variables which have methods + local_vars, # Variables local to the setup method imports, # Set of import declarations methods, # Methods to be generated, a table of names->a_method records - code, # List of strings to generate in the setup method - parent_Canvas, # - indent1, # Spaces for indentation + code, # List of strings to generate in the setup method + parent_Canvas, # + indent1, # Spaces for indentation indent2, # indent3, # indent4 # @@ -128,10 +128,10 @@ class Code( close(f) if f := open(s) then { - ivib_maindialog.source := [] - while put(ivib_maindialog.source, read(f)) - close(f) - } + ivib_maindialog.source := [] + while put(ivib_maindialog.source, read(f)) + close(f) + } return end @@ -150,17 +150,17 @@ class Code( add_setup_methods() if not (f := open(src_name)) then { - alert_error("warning, couldn't open " || src_name) - # the file has disappeared, try writing it from the copy we saved - if f := open(src_name, "w") then { - every write(f, !ivib_maindialog.source) - close(f) - if not (f := open(src_name)) then - return alert_error("Couldn't open " || src_name) - } - else - return alert_error("Couldn't open " || src_name) - } + alert_error("warning, couldn't open " || src_name) + # the file has disappeared, try writing it from the copy we saved + if f := open(src_name, "w") then { + every write(f, !ivib_maindialog.source) + close(f) + if not (f := open(src_name)) then + return alert_error("Couldn't open " || src_name) + } + else + return alert_error("Couldn't open " || src_name) + } # # Save contents up to setup() method @@ -196,7 +196,7 @@ class Code( delete(imports, tab(many(idchars))) } } - put(part1, t) + put(part1, t) } # @@ -242,7 +242,7 @@ class Code( s ? { if ="class " then { # Substitute our own class and superclass name - s := "class " || self.parent_Canvas.name || " : " || + s := "class " || self.parent_Canvas.name || " : " || self.parent_Canvas.superclass_name || "(" tab(upto('(')) move(1) @@ -357,7 +357,7 @@ class Code( every write(f, indent2, !rec.body) write(f, indent1, "end") count +:= 1 - } + } return end @@ -414,7 +414,7 @@ class Code( end # - # Generate a main procedure. + # Generate a main procedure. # method main_out(f) write(f, "procedure main()") diff --git a/uni/ide/ivib/icon/xpmtoims.icn b/uni/ide/ivib/icon/xpmtoims.icn index 3a0ea2d1e..5bc0a586a 100644 --- a/uni/ide/ivib/icon/xpmtoims.icn +++ b/uni/ide/ivib/icon/xpmtoims.icn @@ -1,12 +1,12 @@ ############################################################################ # -# File: xpmtoims.icn +# File: xpmtoims.icn # -# Subject: Program to make Icon images from XPM files +# Subject: Program to make Icon images from XPM files # -# Author: Gregg M. Townsend +# Author: Gregg M. Townsend # -# Date: May 23, 1996 +# Date: May 23, 1996 # ############################################################################ # @@ -94,8 +94,8 @@ procedure dofile(f, fname) EraseArea(0, 0) DrawImage(0, 0, s) while e := Event() do case e of { - QuitEvents(): exit() # quit on "q" etc - !" \t\r\n": break # continue on "\r" etc + QuitEvents(): exit() # quit on "q" etc + !" \t\r\n": break # continue on "\r" etc } } return diff --git a/uni/ide/ivib/main.icn b/uni/ide/ivib/main.icn index 385939cb2..f4e543317 100644 --- a/uni/ide/ivib/main.icn +++ b/uni/ide/ivib/main.icn @@ -92,7 +92,7 @@ end # # This listens for actions to either the menu/button object creation items. # -class ObjectActionListener(main, object_ui) +class ObjectActionListener(main, object_ui) method on_event(event) main.create_in_canvas(object_ui) end @@ -128,7 +128,7 @@ class Main : CommonDialog( new, # New canvas function orig_canvas_width, # Variables for re-sizing canvas orig_canvas_height, # - tool_area_height, # + tool_area_height, # prog_preferences, # Program preferences function centre_horiz, # Centre horizontally command grid, # Grid command @@ -142,7 +142,7 @@ class Main : CommonDialog( centre_vert, # Centre vertically command popup_component, # Popup on component popup_component_dialog, - popup_component_delete, + popup_component_delete, popup_component_fix, # Vertically fix command popup_component_unfix, # Unfix command popup_component_save, # Save component command @@ -177,7 +177,7 @@ class Main : CommonDialog( grid_button, copy_button, last_icn_dir, - source # source file (list of strings) + source # source file (list of strings) ) method show_tooltip(x, y, label) @@ -211,7 +211,7 @@ class Main : CommonDialog( self.undo_button.set_is_shaded() end - # + # # Get undo item # method get_undo() @@ -220,7 +220,7 @@ class Main : CommonDialog( if *undo_list = 0 then clear_undo() return res - end + end # # Push an undo item @@ -249,7 +249,7 @@ class Main : CommonDialog( self.redo_button.set_is_shaded() end - # + # # Get redo item # method get_redo() @@ -258,7 +258,7 @@ class Main : CommonDialog( if *redo_list = 0 then clear_redo() return res - end + end # # Push an redo item @@ -278,11 +278,11 @@ class Main : CommonDialog( if \self.canvas.modified then s ||:= " *" self.filename_label.set_label(file_name(s)) - end + end # # Special custom show to allow a popup during init - # + # method custom_show(a) local s, f, c self.args := a @@ -339,7 +339,7 @@ class Main : CommonDialog( end # - # Push a canvas onto undo list. + # Push a canvas onto undo list. # method push_onto_undo(d) # @@ -537,7 +537,7 @@ class Main : CommonDialog( local d, t if /self.canvas.selected then - op_preferences() + op_preferences() else { t := canvas.dup() d := canvas.selected.dialog() @@ -550,7 +550,7 @@ class Main : CommonDialog( } } end - + # # Add a new CanvasComponent using the given CanvasComponentUI to # create it. @@ -651,7 +651,7 @@ class Main : CommonDialog( end # - # Save as... operation + # Save as... operation # method op_save_as() local fd, s, c @@ -728,8 +728,8 @@ class Main : CommonDialog( # method op_about() local d - d := InfoDialog(["Ivib Version : " || version_number, - "Date : " || version_date, + d := InfoDialog(["Ivib Version : " || version_number, + "Date : " || version_date, "Author : " || version_author], "About ivib") d.show_modeless(self) @@ -787,34 +787,34 @@ class Main : CommonDialog( local s source := [ ] repeat { - if not (s := read(f)) then { - cd := ChoiceDialog("No Ivib layout in "||fname||", append one?") - cd.show_modal() - if not cd.result() then fail - # no ivib layout, need to append - close(f) - if f := open(fname, "w") then { - # write L - every write(f, !source) - # write the empty layout - append_ivib(f) - close(f) - source := [ ] - if f := open(fname) then { - alert_error("added an Ivib interface") - next - } - else return alert_error("Failed to append layout to " || fname) - } - else - return alert_error("No Ivib layout in " || fname) - } - if s == v1_marker then - return load_v1(f, fname) - if s == v2_marker then - return load_v2(f, fname) - put(source, s) - } + if not (s := read(f)) then { + cd := ChoiceDialog("No Ivib layout in "||fname||", append one?") + cd.show_modal() + if not cd.result() then fail + # no ivib layout, need to append + close(f) + if f := open(fname, "w") then { + # write L + every write(f, !source) + # write the empty layout + append_ivib(f) + close(f) + source := [ ] + if f := open(fname) then { + alert_error("added an Ivib interface") + next + } + else return alert_error("Failed to append layout to " || fname) + } + else + return alert_error("No Ivib layout in " || fname) + } + if s == v1_marker then + return load_v1(f, fname) + if s == v2_marker then + return load_v2(f, fname) + put(source, s) + } end # @@ -871,7 +871,7 @@ class Main : CommonDialog( local s, t t := "" while s := read(f) do { - put(source, s) + put(source, s) if s[1] == "#" then t ||:= s[2:0] else @@ -894,7 +894,7 @@ class Main : CommonDialog( if not(c := lang::decode(s)) then return alert_error("Invalid file format") - d := InfoDialog(["Ivib v1 file successfully loaded.", + d := InfoDialog(["Ivib v1 file successfully loaded.", "", "NB - some manual editing may be needed after", "the file is next saved."], @@ -971,7 +971,7 @@ class Main : CommonDialog( else self.op_save_as() } - } + } end # @@ -1592,7 +1592,7 @@ end ############################################################################# # # Preferences for program -# +# class Preferences : CommonDialog(c, okay, cancel, undo_size) method on_okay() integer(self.undo_size.get_contents()) | return alert_error("Non-integer undo size") diff --git a/uni/ide/ivib/version.icn b/uni/ide/ivib/version.icn index 8107d25d9..d89d78ad4 100644 --- a/uni/ide/ivib/version.icn +++ b/uni/ide/ivib/version.icn @@ -8,26 +8,26 @@ ############################################################################ # -# File: version.iol +# File: version.iol # -# Subject: Version info for Ivib +# Subject: Version info for Ivib # -# Author: Robert Parlett +# Author: Robert Parlett # -# Date: 11 June 1999 +# Date: 11 June 1999 # ############################################################################ # # This file is in the public domain. # ############################################################################ -# -# -# -# +# +# +# +# ############################################################################ # -# Links: +# Links: # ############################################################################ @@ -43,9 +43,9 @@ $define version_author "Robert Parlett (r.parlett@dial.pipex.com)" # # 1.01 15 Jun 99 Added saving of program preference info. # 1.02 15 Jun 99 Fixed bug : clipx in check_attribs was clipxx. -# 1.03 19 Jun 99 Optimized editable text area component +# 1.03 19 Jun 99 Optimized editable text area component # 1.04 20 Jun 99 Improved menu structure edit dialog -# Enabled configuring of Components' class names +# Enabled configuring of Components' class names # 1.05 29 Jun 99 Display of button names now from tick() method # 1.06 03 Jul 99 Improvement of handling scrollbars in Scroll- # Area and Table classes. @@ -62,7 +62,7 @@ $define version_author "Robert Parlett (r.parlett@dial.pipex.com)" # handling in tree, table and textlist classes. # PopupMenu class. # 1.11 24 Jul 99 Supports new event handlers in table/text list -# classes; popup menus for components and +# classes; popup menus for components and # canvas. # 1.12 25 Jul 99 Flushing of parent dialog window queues. # Filter facility on text input classes. diff --git a/uni/ide/mainbar.icn b/uni/ide/mainbar.icn index 1ee1b6959..0481837f8 100644 --- a/uni/ide/mainbar.icn +++ b/uni/ide/mainbar.icn @@ -173,7 +173,7 @@ class Mainbar( # Or do they just modify &window such that it needs saved/restored? &window := &null if TextDialog("Enter compiler options: ",,targs,60) == "Okay" then - targs := dialog_value[1] + targs := dialog_value[1] &window := oldwindow # having obtained some compile options, where do they go? Project object? end @@ -196,7 +196,7 @@ class Mainbar( # Or do they just modify &window such that it needs saved/restored? &window := &null if TextDialog("Enter command line arguments: ",,xargs,60) == "Okay" then - xargs := dialog_value[1] + xargs := dialog_value[1] &window := oldwindow # having obtained some run arguments, where do they go? Project object? end @@ -258,13 +258,13 @@ class Mainbar( projectname := ide.ProjectSave() if \projectname then { - pname := file_name(projectname) - filedirectory := projectname[1:(*projectname - *pname)] + pname := file_name(projectname) + filedirectory := projectname[1:(*projectname - *pname)] - newUPro := UProject(pname,filedirectory) + newUPro := UProject(pname,filedirectory) - newUPro.show_modal() - } + newUPro.show_modal() + } projecttype := "Unicon" projectCreated := "TRUE" uidlog.tab_item_1.set_label("Messages: (Project Mode)") @@ -291,12 +291,12 @@ $else # implies Windows for now $endif if \projecttype == "Unicon" then { - chdir(filedirectory) - ide.system("make deps") - ide.system("make -f " || pname2 || "_uprjMakefile > " || - wiconlog || " 2>&1", lst, 1) - ide.showanyerror(wiconlog, lst) - } + chdir(filedirectory) + ide.system("make deps") + ide.system("make -f " || pname2 || "_uprjMakefile > " || + wiconlog || " 2>&1", lst, 1) + ide.showanyerror(wiconlog, lst) + } fileCompiled := "TRUE" end @@ -320,13 +320,13 @@ $endif pname2 := pname[1:*pname-4] if \ (projectCreated | projectOpened) == "TRUE" then { - if \projecttype == "Unicon" then { - chdir(filedirectory) - ide.system("make clean -f " || pname2 || "_uprjMakefile > " || - wiconlog || " 2>&1", lst, 1) - } - ide.showanyerror(wiconlog, lst) - } + if \projecttype == "Unicon" then { + chdir(filedirectory) + ide.system("make clean -f " || pname2 || "_uprjMakefile > " || + wiconlog || " 2>&1", lst, 1) + } + ide.showanyerror(wiconlog, lst) + } else on_project_check() end @@ -337,13 +337,13 @@ $endif pname2 := pname[1:*pname-4] if \projectCreated == "TRUE" then { - if \projecttype == "Unicon" then { - chdir(filedirectory) - ide.system("make clean -f "||pname2||"_uprjMakefile"|| - " > "||wiconlog||" 2>&1",lst,1) - } - ide.showanyerror(wiconlog, lst) - } + if \projecttype == "Unicon" then { + chdir(filedirectory) + ide.system("make clean -f "||pname2||"_uprjMakefile"|| + " > "||wiconlog||" 2>&1",lst,1) + } + ide.showanyerror(wiconlog, lst) + } else on_project_check() end @@ -359,19 +359,19 @@ $else # implies Windows for now console := "cmd " $endif if \projecttype == "Unicon" then { #run unicon projects - chdir(filedirectory) + chdir(filedirectory) $ifdef _UNIX - # path search, see if xterm exists on path, use it - if pathfind("xterm", getenv("PATH")) then { - console :="xterm -hold -e " - ide.system(console || " ./UProject") - } - else #just run without "console || ..." - ide.system(pname2) + # path search, see if xterm exists on path, use it + if pathfind("xterm", getenv("PATH")) then { + console :="xterm -hold -e " + ide.system(console || " ./UProject") + } + else #just run without "console || ..." + ide.system(pname2) $else - ide.system(console || " ./UProject") + ide.system(console || " ./UProject") $endif - } + } end # @@ -379,59 +379,59 @@ $endif # method on_ui_programming_envi(ev) handle_help("doc/utr/utr12.html", - "http://unicon.sourceforge.net/utr/utr12.html") + "http://unicon.sourceforge.net/utr/utr12.html") end method on_tutorial_overview(ev) handle_help("doc/icon/ipd266.htm", - "http://www.cs.arizona.edu/icon/docs/ipd266.htm") + "http://www.cs.arizona.edu/icon/docs/ipd266.htm") end method on_icon_ref() handle_help("doc/icon/ipd266.htm", - "http://www.cs.arizona.edu/icon/refernce/ref.htm") + "http://www.cs.arizona.edu/icon/refernce/ref.htm") end method on_unicon_ref() handle_help("doc/unicon/utr8.html", - "http://unicon.sourceforge.net/utr/utr8.html") + "http://unicon.sourceforge.net/utr/utr8.html") end method on_graphics_ref() handle_help("doc/icon/ipd281.htm", - "http://www.cs.arizona.edu/icon/docs/ipd281.htm") + "http://www.cs.arizona.edu/icon/docs/ipd281.htm") end method on_graphics3D_ref() handle_help("doc/utr/utr9.html", - "http://unicon.org/utr/utr9.html") + "http://unicon.org/utr/utr9.html") end method on_icon_prog_library() handle_help("doc/icon/ipd283.htm", - "http://www.cs.arizona.edu/icon/docs/ipd283.htm") + "http://www.cs.arizona.edu/icon/docs/ipd283.htm") end method on_ivib_interface_builder() handle_help("doc/utr/utr6.html", - "http://unicon.org/utr/utr6.html") + "http://unicon.org/utr/utr6.html") end method on_icon_faq() handle_help("doc/icon/faq.htm", - "http://www.cs.arizona.edu/icon/faq.htm") + "http://www.cs.arizona.edu/icon/faq.htm") end method on_unicon_faq() handle_help("doc/unicon/faq.html", - "http://unicon.sourceforge.net/faq.html") + "http://unicon.sourceforge.net/faq.html") end method on_unicon_manpage() handle_help("doc/unicon/utr11.html", - "http://unicon.org/utr/utr11.html") + "http://unicon.org/utr/utr11.html") end - + # # Launch online help, if we are online. # @@ -440,38 +440,38 @@ $endif local line, p, s if /browser then { - uidlog.MsgBox.set_contents([ - "Sorry, you must configure a browser in order for help to work."]) - fail - } + uidlog.MsgBox.set_contents([ + "Sorry, you must configure a browser in order for help to work."]) + fail + } $ifdef _UNIX if not match("online", is_online()) then { - # use local copy since UI thinks we are offline - if \docpath then { - URL := "file://" || \docpath || filename - } - else URL := "file://" || filename - } + # use local copy since UI thinks we are offline + if \docpath then { + URL := "file://" || \docpath || filename + } + else URL := "file://" || filename + } if find("netscape"|"firefox", \browser) then { - if /browserversion then { - if p := open(\browser || " -version", "p") then { - s := read(p) - close(p) - s ? { - tab(upto(&digits)) - browserversion := real(tab(many(&digits))) - } - } - } - if \browserversion <36 then - URL2 := " -remote 'openURL(" || URL || ")'" - else URL2 := " " || URL - } + if /browserversion then { + if p := open(\browser || " -version", "p") then { + s := read(p) + close(p) + s ? { + tab(upto(&digits)) + browserversion := real(tab(many(&digits))) + } + } + } + if \browserversion <36 then + URL2 := " -remote 'openURL(" || URL || ")'" + else URL2 := " " || URL + } else if browser=="open" then { - URL2 := " -a Safari " || URL - } + URL2 := " -a Safari " || URL + } else URL2 := " " || URL foutname := tempname("ui", ".err") @@ -488,39 +488,39 @@ $ifdef _UNIX if find("netscape"|"firefox", \browser) then { if f := open("cat " || - (if \fout then foutname else "") || - " "|| - (if \fout2 then foutname2 else ""),"p") then { + (if \fout then foutname else "") || + " "|| + (if \fout2 then foutname2 else ""),"p") then { line := "" while line ||:= read(f) map(line) ? { if tab(find(nonot:=("no"|"not")) + *nonot) & tab(many(' ')) & - ="running" then { + ="running" then { # write(&errout, \browser, " not running, reverting to URL") - if \fout then remove(foutname) - if \fout2 then remove(foutname2) - fout := fout2 := &null - fout := open(foutname,"w") + if \fout then remove(foutname) + if \fout2 then remove(foutname2) + fout := fout2 := &null + fout := open(foutname,"w") fout2 := open(foutname2,"w") proc("system",0)(\browser||" "||URL, , fout, fout2, "nowait") - close(\fout) - close(\fout2) - if \fout then remove(foutname) - if \fout2 then remove(foutname2) + close(\fout) + close(\fout2) + if \fout then remove(foutname) + if \fout2 then remove(foutname2) } else { # write(&errout, \browser, " was running, so we are good") } - } + } close(f) } } $else if \docpath then { - URL := "file://" || map(\docpath || filename,"/",PATHSEP) - } + URL := "file://" || map(\docpath || filename,"/",PATHSEP) + } uidlog.MsgBox.set_contents([ - "launching " || browser || " " || URL]) + "launching " || browser || " " || URL]) proc("system",0)(\browser || " " || URL) # || " &") #s := \browser[2:-1] || " " || URL #proc("system",0)(s,,,,1) @@ -618,27 +618,27 @@ $endif method update_view_window(ev) case cur_ide_win_setup of { - "view_window_all" : on_view_window_all(ev) - "view_window_files" : on_view_window_files(ev) - "view_window_filesmsgs" : on_view_window_filesmsgs(ev) - "view_window_filesclassbrowser" : on_view_window_filesclassbrowser(ev) - default : write("ERROR") - } + "view_window_all" : on_view_window_all(ev) + "view_window_files" : on_view_window_files(ev) + "view_window_filesmsgs" : on_view_window_filesmsgs(ev) + "view_window_filesclassbrowser" : on_view_window_filesclassbrowser(ev) + default : write("ERROR") + } end method on_hide_toolbar(ev) if hide_toolbar.get_label() == "Hide Toolbar" then { - cur_ide_tb_status := "hide" - hide_toolbar.set_label("Show Toolbar") - uidlog.pnlToolbar.set_pos("0", "110%") - tb_adj := -4 - } + cur_ide_tb_status := "hide" + hide_toolbar.set_label("Show Toolbar") + uidlog.pnlToolbar.set_pos("0", "110%") + tb_adj := -4 + } else { - cur_ide_tb_status := "show" - hide_toolbar.set_label("Hide Toolbar") - uidlog.pnlToolbar.set_pos("0","4.5%") - tb_adj := 0 - } + cur_ide_tb_status := "show" + hide_toolbar.set_label("Hide Toolbar") + uidlog.pnlToolbar.set_pos("0","4.5%") + tb_adj := 0 + } update_view_window(ev) end @@ -733,47 +733,47 @@ $endif # method set_font(fname, fcolor) local tab_item, buff_editable, type, size, style, l, i:=1, - prefs := uidlog.ui_Preferences + prefs := uidlog.ui_Preferences /fontname := "mono,16" if not (/fname := fontname) then fontname := fname fontname ? { - type := tab(find(",")) - tab(upto(&digits)) - size := integer(tab(many(&digits))) - ="," - style := tab(0) - } + type := tab(find(",")) + tab(upto(&digits)) + size := integer(tab(many(&digits))) + ="," + style := tab(0) + } if size > 36 | type == "" then { - if size > 36 then size := "36" - if type == "" then type := "mono" - fontname := type||","||size - fontname ||:= \style - } + if size > 36 then size := "36" + if type == "" then type := "mono" + fontname := type||","||size + fontname ||:= \style + } uidlog.MsgBox.set_attribs("font=" || fontname) if \prefs.sample_box then { - l := prefs.sample_box.attribs - while i <= *l do { - if match("font=", l[i]) then - delete(l, i) - else - i +:= 1 - } - prefs.sample_box.set_attribs("font=" || fontname) - i := 1 - } + l := prefs.sample_box.attribs + while i <= *l do { + if match("font=", l[i]) then + delete(l, i) + else + i +:= 1 + } + prefs.sample_box.set_attribs("font=" || fontname) + i := 1 + } every tab_item := !uidlog.FileTabSet.children do - every buff_editable := !tab_item.children do { - l := buff_editable.attribs - while i <= *l do { - if match("font=", l[i]) then - delete(l, i) - else - i +:= 1 - } - buff_editable.set_attribs("font="||fontname) - } + every buff_editable := !tab_item.children do { + l := buff_editable.attribs + while i <= *l do { + if match("font=", l[i]) then + delete(l, i) + else + i +:= 1 + } + buff_editable.set_attribs("font="||fontname) + } uidlog.init() uidlog.resize() uidlog.display() @@ -793,19 +793,19 @@ $endif prefs.show_modal() every tab_item := !uidlog.FileTabSet.children do - every buff_editable := !tab_item.children do { - l := buff_editable.attribs - while i <= *l do { - if match("bg=", l[i]) then - delete(l, i) - else - i +:= 1 - } - buff_editable.set_attribs("bg="||prefs.val_background_color) - WAttrib(\ (buff_editable.cbwin), "bg="||prefs.val_background_color) - WAttrib(\ (buff_editable.view.cbwin), - "bg="||prefs.val_background_color) - } + every buff_editable := !tab_item.children do { + l := buff_editable.attribs + while i <= *l do { + if match("bg=", l[i]) then + delete(l, i) + else + i +:= 1 + } + buff_editable.set_attribs("bg="||prefs.val_background_color) + WAttrib(\ (buff_editable.cbwin), "bg="||prefs.val_background_color) + WAttrib(\ (buff_editable.view.cbwin), + "bg="||prefs.val_background_color) + } ceb.display() end @@ -819,10 +819,10 @@ $endif method save_config() local f, pos_x, pos_y, prefs := uidlog.ui_Preferences WAttrib("pos") ? { - pos_x := tab(find(",")) - ="," - pos_y := tab(many('-' ++ &digits)) - } + pos_x := tab(find(",")) + ="," + pos_y := tab(many('-' ++ &digits)) + } pos_x := integer(pos_x) pos_y := integer(pos_y) if /pos_x | pos_x < 0 then pos_x := 0 @@ -831,139 +831,139 @@ $endif width := WAttrib("width") height := WAttrib("height") if f := open(getenv("HOME"|"HOMEDIR"|"LOCALAPPDATA")||PS||FILE,"w") then { - write(f, "position=",win_position, "\n", - "width=",width, "\n", - "height=",height,"\n", - "window_setup=", cur_ide_win_setup, "\n", - "toolbar_status=", cur_ide_tb_status, "\n", - "msglines=",msglines,"\n", - "font=",fontname, "\n", - "linebreak=",linebreak, "\n", - "val_background_color=", prefs.val_background_color, "\n", - "linenumber_highlight_color=", prefs.linenumber_highlight_color, "\n", - "default_text_color=", prefs.default_text_color, "\n", - "cursor_highlight_color=", prefs.cursor_highlight_color, "\n", - "cursor_text_color=", prefs.cursor_text_color, "\n", - "syntax_text_color=", prefs.syntax_text_color, "\n", - "glob_text_color=", prefs.glob_text_color, "\n", - "procedure_text_color=", prefs.procedure_text_color, "\n", - "quote_text_color=", prefs.quote_text_color, "\n", - "comment_text_color=", prefs.comment_text_color, "\n", - "linenumber_text_color=", prefs.linenumber_text_color, "\n", - "text_highlight_color=", prefs.text_highlight_color, "\n", - "error_text_color=", prefs.error_text_color, "\n", - "parentheses_match=", prefs.paren_check_box_state, "\n", - "syntax_highlighting=", prefs.syntax_check_box_state, "\n" - ) - close(f) - } + write(f, "position=",win_position, "\n", + "width=",width, "\n", + "height=",height,"\n", + "window_setup=", cur_ide_win_setup, "\n", + "toolbar_status=", cur_ide_tb_status, "\n", + "msglines=",msglines,"\n", + "font=",fontname, "\n", + "linebreak=",linebreak, "\n", + "val_background_color=", prefs.val_background_color, "\n", + "linenumber_highlight_color=", prefs.linenumber_highlight_color, "\n", + "default_text_color=", prefs.default_text_color, "\n", + "cursor_highlight_color=", prefs.cursor_highlight_color, "\n", + "cursor_text_color=", prefs.cursor_text_color, "\n", + "syntax_text_color=", prefs.syntax_text_color, "\n", + "glob_text_color=", prefs.glob_text_color, "\n", + "procedure_text_color=", prefs.procedure_text_color, "\n", + "quote_text_color=", prefs.quote_text_color, "\n", + "comment_text_color=", prefs.comment_text_color, "\n", + "linenumber_text_color=", prefs.linenumber_text_color, "\n", + "text_highlight_color=", prefs.text_highlight_color, "\n", + "error_text_color=", prefs.error_text_color, "\n", + "parentheses_match=", prefs.paren_check_box_state, "\n", + "syntax_highlighting=", prefs.syntax_check_box_state, "\n" + ) + close(f) + } else - uidlog.MsgBox.set_contents(["couldn't save settings"]) + uidlog.MsgBox.set_contents(["couldn't save settings"]) end method load_config() local f, prefs := uidlog.ui_Preferences, line if f := open(getenv("HOME"|"HOMEDIR"|"LOCALAPPDATA")||PS||FILE,"r") then { - while line := read(f) do { - line ? { - if ="position" then { - tab(upto(&digits)) - win_position := tab(many(&digits ++ ',')) - } - else if ="height" then { - tab(upto(&digits)) - height := integer(tab(many(&digits))) - } - else if ="width" then { - tab(upto(&digits)) - width := integer(tab(many(&digits))) - } - else if ="window_setup" then { - tab(many('= \t')) - cur_ide_win_setup := tab(0) - } - else if ="toolbar_status" then { - tab(many('= \t')) - cur_ide_tb_status := tab(0) - } - else if ="msglines" then { - tab(upto(&digits)) - msglines := integer(tab(many(&digits))) - } - else if ="font" then { - tab(many('= \t')) - fontname := tab(0) - } - else if ="linebreak" then { - tab(many('= \t')) - linebreak := tab(0) - } - else if ="val_background_color" then { - tab(many('= \t')) - prefs.val_background_color := tab(0) - } - else if ="linenumber_highlight_color" then { - tab(many('= \t')) - prefs.linenumber_highlight_color := tab(0) - } - else if ="default_text_color=" then { - tab(many('= \t')) - prefs.default_text_color := tab(0) - } - else if ="cursor_highlight_color" then { - tab(many('= \t')) - prefs.cursor_highlight_color := tab(0) - } - else if ="cursor_text_color" then { - tab(many('= \t')) - prefs.cursor_text_color := tab(0) - } - else if ="syntax_text_color" then { - tab(many('= \t')) - prefs.syntax_text_color := tab(0) - } - else if ="glob_text_color" then { - tab(many('= \t')) - prefs.glob_text_color := tab(0) - } - else if ="procedure_text_color" then { - tab(many('= \t')) - prefs.procedure_text_color := tab(0) - } - else if ="quote_text_color" then { - tab(many('= \t')) - prefs.quote_text_color := tab(0) - } - else if ="comment_text_color" then { - tab(many('= \t')) - prefs.comment_text_color := tab(0) - } - else if ="linenumber_text_color" then { - tab(many('= \t')) - prefs.linenumber_text_color := tab(0) - } - else if ="text_highlight_color" then { - tab(many('= \t')) - prefs.text_highlight_color := tab(0) - } - else if ="error_text_color" then { - tab(many('= \t')) - prefs.error_text_color := tab(0) - } - else if ="parentheses_match" then { - tab(many('= \t')) - prefs.paren_check_box_state := tab(0) - } - else if ="syntax_highlighting" then { - tab(many('= \t')) - prefs.syntax_check_box_state := tab(0) - } - } - } - close(f) - } + while line := read(f) do { + line ? { + if ="position" then { + tab(upto(&digits)) + win_position := tab(many(&digits ++ ',')) + } + else if ="height" then { + tab(upto(&digits)) + height := integer(tab(many(&digits))) + } + else if ="width" then { + tab(upto(&digits)) + width := integer(tab(many(&digits))) + } + else if ="window_setup" then { + tab(many('= \t')) + cur_ide_win_setup := tab(0) + } + else if ="toolbar_status" then { + tab(many('= \t')) + cur_ide_tb_status := tab(0) + } + else if ="msglines" then { + tab(upto(&digits)) + msglines := integer(tab(many(&digits))) + } + else if ="font" then { + tab(many('= \t')) + fontname := tab(0) + } + else if ="linebreak" then { + tab(many('= \t')) + linebreak := tab(0) + } + else if ="val_background_color" then { + tab(many('= \t')) + prefs.val_background_color := tab(0) + } + else if ="linenumber_highlight_color" then { + tab(many('= \t')) + prefs.linenumber_highlight_color := tab(0) + } + else if ="default_text_color=" then { + tab(many('= \t')) + prefs.default_text_color := tab(0) + } + else if ="cursor_highlight_color" then { + tab(many('= \t')) + prefs.cursor_highlight_color := tab(0) + } + else if ="cursor_text_color" then { + tab(many('= \t')) + prefs.cursor_text_color := tab(0) + } + else if ="syntax_text_color" then { + tab(many('= \t')) + prefs.syntax_text_color := tab(0) + } + else if ="glob_text_color" then { + tab(many('= \t')) + prefs.glob_text_color := tab(0) + } + else if ="procedure_text_color" then { + tab(many('= \t')) + prefs.procedure_text_color := tab(0) + } + else if ="quote_text_color" then { + tab(many('= \t')) + prefs.quote_text_color := tab(0) + } + else if ="comment_text_color" then { + tab(many('= \t')) + prefs.comment_text_color := tab(0) + } + else if ="linenumber_text_color" then { + tab(many('= \t')) + prefs.linenumber_text_color := tab(0) + } + else if ="text_highlight_color" then { + tab(many('= \t')) + prefs.text_highlight_color := tab(0) + } + else if ="error_text_color" then { + tab(many('= \t')) + prefs.error_text_color := tab(0) + } + else if ="parentheses_match" then { + tab(many('= \t')) + prefs.paren_check_box_state := tab(0) + } + else if ="syntax_highlighting" then { + tab(many('= \t')) + prefs.syntax_check_box_state := tab(0) + } + } + } + close(f) + } else - return "couldn't load saved settings" + return "couldn't load saved settings" end # @@ -1197,7 +1197,7 @@ $endif debuggIt := TextMenuItem() debuggIt.set_label("Debug program") debuggIt.connect(self, "on_debuggIt", ACTION_EVENT) - menu_10.add(debuggIt) + menu_10.add(debuggIt) menu_bar_1.add(menu_10) menu_12 := Menu() menu_12.set_label("Project") diff --git a/uni/ide/matchparen.icn b/uni/ide/matchparen.icn index dab6f2023..852bab2ef 100644 --- a/uni/ide/matchparen.icn +++ b/uni/ide/matchparen.icn @@ -5,12 +5,12 @@ class MatchParen(stack, matching, closing_paren, opening_paren) "("|")" : return "(" "["|"]" : return "[" "{"|"}" : return "{" - } + } end - method add_char(c, cur_pos, i) + method add_char(c, cur_pos, i) local n, m := leftMatch(c) - + if \m & \cur_pos then { if m == c then # c is some kind of left parenthesis push(stack, [m,i]) # push a Character version, m and its position @@ -27,18 +27,18 @@ class MatchParen(stack, matching, closing_paren, opening_paren) return n[2] } } - + else if \m then { if m == c then # c is some kind of left parenthesis push(stack, m) # push a Character version, m else { if (not (n := pop(stack))) | (n ~=== m) then { - return matching := "false" - } + return matching := "false" + } } } end - + method add_string(s, cur_pos) local i, match_paren_pos every i := 1 to *s do { @@ -50,13 +50,13 @@ class MatchParen(stack, matching, closing_paren, opening_paren) method test(s, cur_pos) local match_paren_pos - + stack := [] matching := "true" #if \cur_pos then # if not member(closing_paren, s[cur_pos-1:cur_pos]) then return - + match_paren_pos:=add_string(s, cur_pos) if \cur_pos & \match_paren_pos then diff --git a/uni/ide/modified.icn b/uni/ide/modified.icn index 04f51afe3..a148677ad 100644 --- a/uni/ide/modified.icn +++ b/uni/ide/modified.icn @@ -12,7 +12,7 @@ end class close_modifieddialog : Dialog(f, position, selection, no_btn, save_btn, cancel_btn, label_1) - method component_setup() + method component_setup() local pos_x, pos_y, size_x, size_y WAttrib("pos") ? { pos_x := tab(find(",")) @@ -44,7 +44,7 @@ class close_modifieddialog : Dialog(f, position, selection, no_btn, method setup() self.set_attribs("size=350,75", "pos="||position) - + label_1 := Label() label_1.set_pos(12, 7) label_1.set_size("320", "15") @@ -60,7 +60,7 @@ class close_modifieddialog : Dialog(f, position, selection, no_btn, no_btn.set_label("No") no_btn.set_internal_alignment("c") self.add(no_btn) - + save_btn := TextButton() save_btn.set_pos("140", "40") save_btn.set_size("60", ) @@ -88,7 +88,7 @@ end class exit_modifieddialog : Dialog(position, selection, cancel_btn, save_btn, save_all_btn, exit_without_saving_btn, label_1) - method component_setup() + method component_setup() local pos_x, pos_y, size_x, size_y WAttrib("pos") ? { pos_x := tab(find(",")) @@ -125,7 +125,7 @@ class exit_modifieddialog : Dialog(position, selection, cancel_btn, save_btn, method setup() self.set_attribs("size=350,75", "pos="||position) - + label_1 := Label() label_1.set_pos(12, 7) label_1.set_size("320", "15") @@ -141,7 +141,7 @@ class exit_modifieddialog : Dialog(position, selection, cancel_btn, save_btn, cancel_btn.set_label("Cancel") cancel_btn.set_internal_alignment("c") self.add(cancel_btn) - + save_btn := TextButton() save_btn.set_pos("80", "40") save_btn.set_size("60", ) @@ -167,13 +167,13 @@ class exit_modifieddialog : Dialog(position, selection, cancel_btn, save_btn, exit_without_saving_btn.clear_toggles() exit_without_saving_btn.set_label("Exit Anyways") exit_without_saving_btn.set_internal_alignment("c") - self.add(exit_without_saving_btn) + self.add(exit_without_saving_btn) end initially self.Dialog.initially() end - + procedure AskSave(fn) local m := ModifiedDialog() if \fn then @@ -183,7 +183,7 @@ procedure AskSave(fn) end class ModifiedDialog : Dialog(selection, cancel_btn, label_1, - no_btn, saveas_btn, yes_btn) + no_btn, saveas_btn, yes_btn) method component_setup() self.setup() end diff --git a/uni/ide/online.icn b/uni/ide/online.icn index f2a06ec74..ccc67b967 100644 --- a/uni/ide/online.icn +++ b/uni/ide/online.icn @@ -13,13 +13,13 @@ local pathto, rv, f, line } else { if f := open("/sbin/ifconfig", "p") then { - while line := read(f) do { - line ? { - if tab(find("inet addr:127.0.0.1")) then next - if tab(find("inet addr:")) then return "online, I think" - } - } - } + while line := read(f) do { + line ? { + if tab(find("inet addr:127.0.0.1")) then next + if tab(find("inet addr:")) then return "online, I think" + } + } + } return "don't know, assume not" } end diff --git a/uni/ide/preferences.icn b/uni/ide/preferences.icn index ea532bffb..a8ec9c7f3 100644 --- a/uni/ide/preferences.icn +++ b/uni/ide/preferences.icn @@ -48,7 +48,7 @@ class DialogPreferences : Dialog( pos_x := tab(find(",")) ="," pos_y := tab(many('-0123456789')) - } + } if /pos_x | pos_x < 0 then pos_x := 0 if /pos_y | pos_y < 0 then pos_y := 0 position := pos_x||","||pos_y @@ -62,7 +62,7 @@ class DialogPreferences : Dialog( delete(l, i) else i +:= 1 - } + } self.set_attribs("pos=" || position) } end @@ -73,7 +73,7 @@ class DialogPreferences : Dialog( update() set_focus(list_bg_color) end - + method end_dialog() vbc:=stc:=mtc:=ltc:=thc:=etc:=lhc:=dtc:=chc:=ctc:=gtc:=ptc:=qtc:=&null end @@ -87,17 +87,17 @@ class DialogPreferences : Dialog( temp_val_background_color := list_bg_color.get_string_selection() update() end - + method on_list_syntax_color(ev) temp_syntax_text_color := list_syntax_color.get_string_selection() update() end - + method on_list_comment_color(ev) temp_comment_text_color := list_comment_color.get_string_selection() update() end - + method on_list_linenumber_color(ev) temp_linenumber_text_color := list_linenumber_color.get_string_selection() update() @@ -115,7 +115,7 @@ class DialogPreferences : Dialog( method update() local i, l - + l := sample_box.attribs i := 1 if \temp_val_background_color then { @@ -136,14 +136,14 @@ class DialogPreferences : Dialog( cursor_text_color := "black" } else - val_background_color := "white" + val_background_color := "white" linenumber_highlight_color := val_background_color while i <= *l do { if match("bg=", l[i]) then delete(l, i) else i +:= 1 - } + } sample_box.set_attribs("bg="||val_background_color) WAttrib(\ (sample_box.cbwin), "bg="||val_background_color) WAttrib(\ (sample_box.view.cbwin), "bg="||val_background_color) @@ -203,7 +203,7 @@ class DialogPreferences : Dialog( method check_box_syntax_highlighting_on(ev) end - + method on_text_button_ok(ev) exit_with_saving() end @@ -217,7 +217,7 @@ class DialogPreferences : Dialog( syntax_check_box_state:=check_box_syntax_highlighting_on.is_checked_flag dispose() end - + method exit_without_saving() local i, l if \vbc then { @@ -229,23 +229,23 @@ class DialogPreferences : Dialog( delete(l, i) else i +:= 1 - } + } sample_box.set_attribs("bg="||val_background_color) WAttrib(\ (sample_box.cbwin), "bg="||val_background_color) WAttrib(\ (sample_box.view.cbwin), "bg="||val_background_color) sample_box.display() } - default_text_color := \dtc + default_text_color := \dtc cursor_highlight_color := \chc - cursor_text_color := \ctc + cursor_text_color := \ctc syntax_text_color := \stc - linenumber_highlight_color := \lhc - glob_text_color := \gtc - procedure_text_color := \ptc + linenumber_highlight_color := \lhc + glob_text_color := \gtc + procedure_text_color := \ptc quote_text_color := \qtc - comment_text_color := \mtc - linenumber_text_color := \ltc - text_highlight_color := \thc + comment_text_color := \mtc + linenumber_text_color := \ltc + text_highlight_color := \thc error_text_color := \etc check_box_paren_on.is_checked_flag:=paren_check_box_state check_box_syntax_highlighting_on.is_checked_flag:=syntax_check_box_state @@ -254,7 +254,7 @@ class DialogPreferences : Dialog( method initialize_values() if /position then position := "0,0" - + if /val_background_color then { val_background_color := "white" linenumber_highlight_color := "white" @@ -277,7 +277,7 @@ class DialogPreferences : Dialog( if /error_text_color then error_text_color := "red" end - + method setup() self.set_attribs("size=640,200", "pos="||position) @@ -287,9 +287,9 @@ class DialogPreferences : Dialog( sample_box.set_size("75%", "75%-4") sample_box.set_contents(["# Sample Code w/ Error", "procedure main()", " local c", - " c:=Hello()", "end", "", - "class Hello ()", - " write(\"Hello World\")", "end"]) + " c:=Hello()", "end", "", + "class Hello ()", + " write(\"Hello World\")", "end"]) list_bg_color := List() list_bg_color.set_pos(25, 25) @@ -301,22 +301,22 @@ class DialogPreferences : Dialog( list_syntax_color.set_pos(125, 25) list_syntax_color.set_size("100") list_syntax_color.connect(self, "on_list_syntax_color", - SELECTION_CHANGED_EVENT) + SELECTION_CHANGED_EVENT) list_syntax_color.set_selection_list(["light-colors", "dark-colors", - "bright-colors"]) - + "bright-colors"]) + list_comment_color := List() list_comment_color.set_pos(225, 25) list_comment_color.set_size("100") list_comment_color.connect(self, "on_list_comment_color", - SELECTION_CHANGED_EVENT) + SELECTION_CHANGED_EVENT) list_comment_color.set_selection_list(["blue", "red", "green"]) list_linenumber_color := List() list_linenumber_color.set_pos(325, 25) list_linenumber_color.set_size("100") list_linenumber_color.connect(self, "on_list_linenumber_color", - SELECTION_CHANGED_EVENT) + SELECTION_CHANGED_EVENT) list_linenumber_color.set_selection_list(["grey","black","white","brown", "dark-yellow", "yellow"]) @@ -324,17 +324,17 @@ class DialogPreferences : Dialog( list_highlight_color.set_pos(425, 25) list_highlight_color.set_size("100") list_highlight_color.connect(self, "on_list_highlight_color", - SELECTION_CHANGED_EVENT) + SELECTION_CHANGED_EVENT) list_highlight_color.set_selection_list(["light-grey", "white-grey", - "yellow"]) + "yellow"]) list_error_color := List() list_error_color.set_pos(525, 25) list_error_color.set_size("100") list_error_color.connect(self, "on_list_error_color", - SELECTION_CHANGED_EVENT) + SELECTION_CHANGED_EVENT) list_error_color.set_selection_list(["red", "dark-red", "pink"]) - + label_background_color := Label() label_background_color.set_pos("35", "10") label_background_color.set_internal_alignment("l") @@ -344,7 +344,7 @@ class DialogPreferences : Dialog( label_syntax_color.set_pos("135", "10") label_syntax_color.set_internal_alignment("l") label_syntax_color.set_label("Syntax:") - + label_comment_color := Label() label_comment_color.set_pos("235", "10") label_comment_color.set_internal_alignment("l") @@ -392,16 +392,16 @@ class DialogPreferences : Dialog( label_syntax_highlighting2.set_pos("530", "132") label_syntax_highlighting2.set_internal_alignment("l") label_syntax_highlighting2.set_label("Highlighting:") - + check_box_syntax_highlighting_on := CheckBox() check_box_syntax_highlighting_on.set_pos("555", "146") check_box_syntax_highlighting_on.connect(self, - "check_box_syntax_highlighting_on", ACTION_EVENT) + "check_box_syntax_highlighting_on", ACTION_EVENT) check_box_syntax_highlighting_on.set_toggles() if \syntax_check_box_state = 1 then check_box_syntax_highlighting_on.set_is_checked() check_box_syntax_highlighting_on.set_label("On") - + text_button_ok := TextButton() text_button_ok.set_pos(595, 170) text_button_ok.connect(self, "on_text_button_ok", BUTTON_RELEASE_EVENT) @@ -411,10 +411,10 @@ class DialogPreferences : Dialog( text_button_cancel := TextButton() text_button_cancel.set_pos(535, 170) text_button_cancel.connect(self, "on_text_button_cancel", - BUTTON_RELEASE_EVENT) + BUTTON_RELEASE_EVENT) text_button_cancel.set_internal_alignment("c") text_button_cancel.set_label("Cancel") - + self.add(sample_box) self.add(list_bg_color) self.add(list_syntax_color) diff --git a/uni/ide/ptyDispatcher.icn b/uni/ide/ptyDispatcher.icn index 6a10c3487..6eaed3751 100644 --- a/uni/ide/ptyDispatcher.icn +++ b/uni/ide/ptyDispatcher.icn @@ -10,7 +10,7 @@ $include "keysyms.icn" $include "guih.icn" -class ptyDispatcher : Dispatcher (ptys, connections) +class ptyDispatcher : Dispatcher (ptys, connections) method add_pty (n) insert(ptys, n) @@ -27,22 +27,22 @@ class ptyDispatcher : Dispatcher (ptys, connections) idle_sleep := 3 dialogwins := set() - + while \r.is_open do { connections := [] every insert(dialogwins, (!dialogs).win) every put(connections, !dialogwins | !ptys) - - if *(L := select(connections,1)) > 0 then { - every x := !L do { + + if *(L := select(connections,1)) > 0 then { + every x := !L do { if member(dialogwins, x) then { - do_event() + do_event() break next } else if member(ptys, x) then { - ide.do_pty_event() - break next - } + ide.do_pty_event() + break next + } } } else { @@ -51,13 +51,13 @@ class ptyDispatcher : Dispatcher (ptys, connections) } end - + initially () self$Dispatcher.initially() ptys := set() connections := [] - + end - + diff --git a/uni/ide/qu_replace.icn b/uni/ide/qu_replace.icn index 10ca0a047..929c6a909 100644 --- a/uni/ide/qu_replace.icn +++ b/uni/ide/qu_replace.icn @@ -30,7 +30,7 @@ class qu_replace : Dialog(s1, s2, text_button_close, text_field_1, text_field_2, ceb.cursor_x := second_x ide.handle_select_str(e, first_x, second_x, ceb.cursor_y) - + get_clipboard().set_content(replace_str) ceb.handle_paste() end @@ -45,10 +45,10 @@ class qu_replace : Dialog(s1, s2, text_button_close, text_field_1, text_field_2, if s1 == "" then fail if ide.findstring(\s1) then { - second_x := ceb.cursor_x - first_x := second_x - *s1 - ide.handle_select_str(&null, first_x, second_x, ceb.cursor_y) - } + second_x := ceb.cursor_x + first_x := second_x - *s1 + ide.handle_select_str(&null, first_x, second_x, ceb.cursor_y) + } # wrap to begining of buffer else if /direction_flag then { uidlog.MsgBox.set_contents(["end of buffer.\n searching from the top."]) @@ -66,12 +66,12 @@ class qu_replace : Dialog(s1, s2, text_button_close, text_field_1, text_field_2, method on_text_button_find(ev) return do_find(text_field_1.get_contents(), - check_box_backwards.is_checked_flag) + check_box_backwards.is_checked_flag) end method handle_pnl_find(ev) return do_find(ide.text_field_search.get_contents(), - ide.toggle_find_dir_btn.is_checked_flag) + ide.toggle_find_dir_btn.is_checked_flag) end @@ -82,7 +82,7 @@ class qu_replace : Dialog(s1, s2, text_button_close, text_field_1, text_field_2, s2 := text_field_2.get_contents() if s1 == "" then fail if s2 == "" then fail - + second_x := ide.CurrentEditBox().cursor_x first_x := second_x - *s1 wu_replace(ev, first_x, second_x, s2) @@ -96,13 +96,13 @@ class qu_replace : Dialog(s1, s2, text_button_close, text_field_1, text_field_2, s2 := text_field_2.get_contents() if s1 == "" then fail if s2 == "" then fail - + while ide.findstring(s1) do { second_x := ide.CurrentEditBox().cursor_x first_x := second_x - (*s1) - wu_replace(ev, first_x, second_x, s2) - } - ide.modified := 1 + wu_replace(ev, first_x, second_x, s2) + } + ide.modified := 1 end method on_check_box_backwards(ev) @@ -212,7 +212,7 @@ class qu_replace : Dialog(s1, s2, text_button_close, text_field_1, text_field_2, initially self.Dialog.initially() - + end diff --git a/uni/ide/shelletl.icn b/uni/ide/shelletl.icn index 6d41af4c9..6cd9d6ead 100644 --- a/uni/ide/shelletl.icn +++ b/uni/ide/shelletl.icn @@ -42,18 +42,18 @@ class ShellETL : EditableTextList ( changed, moved, mouse_locked, scroll_locked, - vi, # virtual line index - undolist, # Taken from old-version editabletextlist - wordlist, # Taken from old-version editabletextlist - noedit, # Taken from old-version editabletextlist - startdragx, # Taken from old-version editabletextlist - enddragx, # Taken from old-version editabletextlist - startdragy, # Taken from old-version editabletextlist - enddragy, # Taken from old-version editabletextlist - donedrag, # Taken from old-version editabletextlist + vi, # virtual line index + undolist, # Taken from old-version editabletextlist + wordlist, # Taken from old-version editabletextlist + noedit, # Taken from old-version editabletextlist + startdragx, # Taken from old-version editabletextlist + enddragx, # Taken from old-version editabletextlist + startdragy, # Taken from old-version editabletextlist + enddragy, # Taken from old-version editabletextlist + donedrag, # Taken from old-version editabletextlist highlightcolor, # Taken from buffertextlist - autoindent, # Taken from buffertextlist - scroll_y, # Taken from buffertextlist + autoindent, # Taken from buffertextlist + scroll_y, # Taken from buffertextlist objType, pos,result,counter,found, pmlbl_width @@ -72,7 +72,7 @@ class ShellETL : EditableTextList ( if match(attr, attribs[i]) then { attribs[i] := attrval return - } + } } } return self$EditableTextList.set_attribs(attrval) @@ -111,44 +111,44 @@ class ShellETL : EditableTextList ( # note that if we aren't at the end of the editable buffer, we # probably should not be trying to execute anything. if cursor_y < *contents - 2 then { - write(&errout, "missing end-of-buffer check before writing to shell") + write(&errout, "missing end-of-buffer check before writing to shell") goto_line(*contents,1) } else { - cmdln := contents[cursor_y] - if \cmdln then { # if cmdln is non-null - write(ide.pty, cmdln) # write it to the pseudo-tty - - cmdln ? { # scan string - if cmdstr := tab(upto(' ')) then move(1) - else cmdstr := cmdln - shellcmd := cmdstr - case map(\cmdstr) of { - "b" | "break" : { - highlightline := integer(tab(many(&digits))) - } - "r" | "run" : { - runs := 1 -# every i := 1 to *file_contents do -# if find("main", file_contents[i]) then rnln := i - if \rnln < highlightline then { - rnln := highlightline - } - } - "q" | "quit" : { - ide.debugger := 0 + cmdln := contents[cursor_y] + if \cmdln then { # if cmdln is non-null + write(ide.pty, cmdln) # write it to the pseudo-tty + + cmdln ? { # scan string + if cmdstr := tab(upto(' ')) then move(1) + else cmdstr := cmdln + shellcmd := cmdstr + case map(\cmdstr) of { + "b" | "break" : { + highlightline := integer(tab(many(&digits))) + } + "r" | "run" : { + runs := 1 +# every i := 1 to *file_contents do +# if find("main", file_contents[i]) then rnln := i + if \rnln < highlightline then { + rnln := highlightline + } + } + "q" | "quit" : { + ide.debugger := 0 # write("shelletl.handlereturn debugger is ", image(ide.debugger)) # uidlog.DevTabSet.set_which_one(uidlog.tab_item_3) - } - default : { highlightline := integer(tab(many(&digits))) } - } - } - - f := open(wiconlog, "a") | stop("Can't open the logfile") - close(f) - showanyresult(wiconlog, ide.dlst) - } - } + } + default : { highlightline := integer(tab(many(&digits))) } + } + } + + f := open(wiconlog, "a") | stop("Can't open the logfile") + close(f) + showanyresult(wiconlog, ide.dlst) + } + } self.EditableTextList.handle_return(e) resize() refresh(1) @@ -183,13 +183,13 @@ class ShellETL : EditableTextList ( set_cursor_y(*ide.dlst) goto_line(*ide.dlst,1) handle_delete_line() - + msgboxSize := *(uidlog.PtyBox.get_contents()) uidlog.PtyBox.set_cursor_y(msgboxSize) uidlog.PtyBox.goto_line(msgboxSize, 1) uidlog.PtyBox.handle_delete_line() end - + # # # # @@ -204,14 +204,14 @@ class ShellETL : EditableTextList ( constrain_cursor() refresh() #text_area_to_high() - } + } else if E := (\hsb).handle_event(e) then { # # Handled by HSB; amend left offset and refresh # constrain_cursor() refresh() - } + } else { if e === -11 then fail # window closed, nothing to do? old_contents_size := *contents @@ -250,7 +250,7 @@ class ShellETL : EditableTextList ( "\^v" : handle_paste(e) "\^z" : handle_undo(e) "\^y" : handle_redo(e) - default : handle_default(e) + default : handle_default(e) } } if \moved then { @@ -260,7 +260,7 @@ class ShellETL : EditableTextList ( constrain_line() refresh(1) return _Event(e, self, 0) - } + } else if \changed then { if (*contents ~= old_contents_size) | \long_line | (old_mw ~= TextWidth(cwin,contents[long_line])) then { @@ -269,13 +269,13 @@ class ShellETL : EditableTextList ( # screen and re-display whole object. set_internal_fields() constrain_line() - display() + display() if e === -11 then fail - } + } else { constrain_line() refresh(1) - } + } return _Event(e, self, 0) } } @@ -289,7 +289,7 @@ class ShellETL : EditableTextList ( if find(".icn", tblbl) then promptlbl := "(udb)" else uidlog.PtyBox.set_contents(uidlog.PtyBox.get_contents() ||| ["Not a Unicon program."]) } - + pmlbl_width := TextWidthEx(cbwin, promptlbl) end @@ -319,7 +319,7 @@ class ShellETL : EditableTextList ( left_string(cbwin, xp - pmlbl_width, yp,"(udb)") else { left_string(cbwin, xp - pmlbl_width, yp,"(ICI)") # prompt - } + } } else { Fg(cbwin, "black") #line_num color @@ -356,8 +356,8 @@ class ShellETL : EditableTextList ( left_string(cw, xp + off, yp + 1, s[si]) Uncouple(cw) - } - else { + } + else { cw := Clone(cbwin, "fg=red") Rectangle(cw, xp + TextWidthEx(cbwin, s, 1, si, tab_width), @@ -373,42 +373,42 @@ class ShellETL : EditableTextList ( (mark_y > v.index > cursor_y) then { # Whole line selected r := [v.first, v.last] - } - else if v.index = mark_y = cursor_y then { + } + else if v.index = mark_y = cursor_y then { # Part of line if mark_x < cursor_x then { r := range(v.first, v.last, mark_x, cursor_x) - } + } else if mark_x > cursor_x then { r := range(v.first, v.last, cursor_x + 1 , mark_x) - } - } - else if v.index = mark_y then { + } + } + else if v.index = mark_y then { if mark_y < cursor_y then { r := range(v.first, v.last, mark_x, - *contents[v.index] + 1) - } - else { + *contents[v.index] + 1) + } + else { r := range(v.first, v.last, 1, mark_x) - } - } - else if v.index = cursor_y then { + } + } + else if v.index = cursor_y then { if mark_y > cursor_y then { r := range(v.first, v.last, cursor_x + 1, - *contents[v.index] + 1) - } - else { + *contents[v.index] + 1) + } + else { r := range(v.first, v.last, 1, cursor_x) - } + } } if \r then { off1 := TextWidthEx(cbwin, s, 1, r[1] - v.first + 1, - tab_width) + tab_width) off2 := TextWidthEx(cbwin, s, 1, r[2] - v.first + 1, - tab_width) + tab_width) FillRectangle(rev, xp + off1, 1 + yp - line_height / 2, - off2 - off1, line_height) - } + off2 - off1, line_height) + } } end @@ -426,22 +426,22 @@ class ShellETL : EditableTextList ( # if \has_focus then { # scroll_y := &y -# while Event() === &mdrag do { -# if &y > scroll_y then { -# handle_key_down() -# handle_key_down() -# handle_key_down() -# } -# if &y < scroll_y then { -# handle_key_up() -# handle_key_up() -# handle_key_up() -# } -# constrain_line() -# refresh(1) -# # text_area_to_high() -# } -# } +# while Event() === &mdrag do { +# if &y > scroll_y then { +# handle_key_down() +# handle_key_down() +# handle_key_down() +# } +# if &y < scroll_y then { +# handle_key_up() +# handle_key_up() +# handle_key_up() +# } +# constrain_line() +# refresh(1) +# # text_area_to_high() +# } +# } # end # # # @@ -473,13 +473,13 @@ class ShellETL : EditableTextList ( tab_line ? { while x12 := move(1) do { - linepos +:= 1 + linepos +:= 1 if /use_selfcontents then { - if posx == endpos - 1 then # stop at the pos. in the line displayed + if posx == endpos - 1 then # stop at the pos. in the line displayed return sblnks - numtabs } else { - if linepos == endpos then # stop where at endpos in contents + if linepos == endpos then # stop where at endpos in contents return sblnks - numtabs } if x12 == "\t" then { diff --git a/uni/ide/ui.icn b/uni/ide/ui.icn index 9e49953f9..5aca67d2e 100644 --- a/uni/ide/ui.icn +++ b/uni/ide/ui.icn @@ -1,12 +1,12 @@ ########################################################################### # -# File: ui.icn +# File: ui.icn # -# Subject: Unicon IDE, an integrated programming environment +# Subject: Unicon IDE, an integrated programming environment # -# Authors: Hani Bani Salameh, Nolan Clayton and Clinton Jeffery +# Authors: Hani Bani Salameh, Nolan Clayton and Clinton Jeffery # -# Date: July 2, 2007 +# Date: July 2, 2007 # ############################################################################ # @@ -14,9 +14,9 @@ # for Unicon. It is gradually gaining features and usability. # # To do: -# keyboard shortcuts -# multiple edit regions. -# +# keyboard shortcuts +# multiple edit regions. +# ############################################################################ # # Requires: graphics, version 2 GUI libraries, and ivib @@ -71,12 +71,12 @@ class UIDE : Dialog( method open_win() local i if not (self.win := (WOpen ! (["inputmask=mc"] ||| self.attribs))) then { - every i := 1 to *self.attribs do if match("font=", self.attribs[i]) then { - delete(self.attribs, i) - if not (self.win := (WOpen ! (["inputmask=mc"] ||| self.attribs))) then fatal("couldn't open window") - else break # might need to do more here to indicate font setting was lost - } - } + every i := 1 to *self.attribs do if match("font=", self.attribs[i]) then { + delete(self.attribs, i) + if not (self.win := (WOpen ! (["inputmask=mc"] ||| self.attribs))) then fatal("couldn't open window") + else break # might need to do more here to indicate font setting was lost + } + } self.buffer_win := (WOpen ! (["canvas=hidden"] ||| self.attribs)) | fatal("couldn't open window") Raise(self.win) return @@ -122,11 +122,11 @@ class UIDE : Dialog( ui_Preferences := DialogPreferences() error_msg := menubar.load_config() if \ui_Preferences.paren_check_box_state == "" then - ui_Preferences.paren_check_box_state := &null + ui_Preferences.paren_check_box_state := &null if \ui_Preferences.syntax_check_box_state == "" then - ui_Preferences.syntax_check_box_state := &null + ui_Preferences.syntax_check_box_state := &null if not (blank_window := open("u_ide_blank", "g", "canvas=hidden")) then - return "can't open window" + return "can't open window" if /win_position then win_position := "2,3" if /height then height := WAttrib(blank_window, "displayheight") - 150 if /width then width := WAttrib(blank_window, "displaywidth") - 150 @@ -155,31 +155,31 @@ class UIDE : Dialog( if \MsgBox.contents then { m := "" every m ||:= !!MsgBox.contents - } + } if /is_MSWindows then { # browser search appears random but should actually should be in order # of how well docs are displayed (in-line, external tool, or not at all) every browser := getenv("BROWSER") | "qupzilla" | "surf" | "uzbl" | "dillo" | - "firefox" | "chromium-browser" | "opera" | "netscape" | "open" | "midori" | "mozilla" do { - if stat(getpaths() || browser) then { - MsgBox.set_contents(["found browser " || browser, \m]) - break - } - else browser := &null - } - } + "firefox" | "chromium-browser" | "opera" | "netscape" | "open" | "midori" | "mozilla" do { + if stat(getpaths() || browser) then { + MsgBox.set_contents(["found browser " || browser, \m]) + break + } + else browser := &null + } + } else { (browser := "\""|| ( - WinAssociate("HTM") | + WinAssociate("HTM") | (getenv("ProgramW6432"|"ProgramFiles"|"ProgramFiles(x86)") || - "\\Internet Explorer\\iexplore.exe")) || "\"") | + "\\Internet Explorer\\iexplore.exe")) || "\"") | write("What, no browser? Unicon's online help won't be readable \n_ until you associate an HTML reader application with the HTM \n_ file extension.\n") } # iexplore runs off http:// but not file:// if (not find("iexplore.exe", \browser)) | - (not match("online", is_online())) then set_docpath() + (not match("online", is_online())) then set_docpath() # if not verify_make() then on_close() end @@ -195,26 +195,26 @@ class UIDE : Dialog( menubar.set_font() # queue up an lpress to set the initial focus to the editor buffer if \win then { - Enqueue(\win, &lpress, EditBox.x+2, EditBox.y+2) - } + Enqueue(\win, &lpress, EditBox.x+2, EditBox.y+2) + } end # Proposed function key bindings. Still under construction. # Loosely based on Borland-style IDE keybindings. # -# Key Base Control Alt Shift -# F1 Help search@crsr help/srch help index -# F2 Save file restart Find(next) grep -# F3 Open file callstack closewin New file +# Key Base Control Alt Shift +# F1 Help search@crsr help/srch help index +# F2 Save file restart Find(next) grep +# F3 Open file callstack closewin New file # F4 Run to cursor -# F5 Toggle breakpt User screen -# F6 Next win/tab Previous win -# F7 Step set watchpt -# F8 Next set breakpt -# F9 Make Run Compileonly Run/debug -# F10 Main menu -# F11 runtime msgs project dlg inspect -# F12 compiler msgs toggle ivib +# F5 Toggle breakpt User screen +# F6 Next win/tab Previous win +# F7 Step set watchpt +# F8 Next set breakpt +# F9 Make Run Compileonly Run/debug +# F10 Main menu +# F11 runtime msgs project dlg inspect +# F12 compiler msgs toggle ivib # alt-x = exit @@ -223,19 +223,19 @@ class UIDE : Dialog( # method on_function_key(ev) case ev.param of { - Key_F1: ide_key_file_menu() - Key_F2: ide_key_help_menu() - Key_F3: ide_handle_save() - Key_F4: ide_handle_open() - Key_F5: ide_prev_tab() - Key_F6: ide_next_tab() - Key_F7: ""#ide_handle_compile() - Key_F8: ""#ide_handle_run() - Key_F9: "" - Key_F10: "" - Key_F11: "" - Key_F12: ide_handle_exit() - } + Key_F1: ide_key_file_menu() + Key_F2: ide_key_help_menu() + Key_F3: ide_handle_save() + Key_F4: ide_handle_open() + Key_F5: ide_prev_tab() + Key_F6: ide_next_tab() + Key_F7: ""#ide_handle_compile() + Key_F8: ""#ide_handle_run() + Key_F9: "" + Key_F10: "" + Key_F11: "" + Key_F12: ide_handle_exit() + } end # @@ -347,8 +347,8 @@ class UIDE : Dialog( self.min_width := 645 self.min_height := 485 self.set_attribs("size="||width||","||height, "pos="||win_position, - "bg=pale gray", - "label=Unicon IDE", "font=mono,16", "resize=on") + "bg=pale gray", + "label=Unicon IDE", "font=mono,16", "resize=on") DevTabSet := TabSet() DevTabSet.set_pos("0", "100%-110") @@ -365,7 +365,7 @@ class UIDE : Dialog( PtyBox := ShellETL() PtyBox.set_pos("2", "2") - PtyBox.set_size("100%-4", "100%-4") + PtyBox.set_size("100%-4", "100%-4") PtyBox.set_draw_border() PtyBox.set_attribs("bg=yellowish white", "font="||fontname) PtyBox.set_contents([""]) @@ -378,7 +378,7 @@ class UIDE : Dialog( EditBox.set_size("100%-4", "100%-4") EditBox.set_draw_border() EditBox.set_attribs("bg="||ui_Preferences.val_background_color, - "font="||fontname) + "font="||fontname) EditBox.set_contents([""]) DevTabSet.add(tab_item_1) @@ -386,7 +386,7 @@ class UIDE : Dialog( DevTabSet.add(tab_item_4) DevTabSet.connect(self, "change", SELECTION_CHANGED_EVENT) self.add(DevTabSet) - + FileTabSet := BufferTabSet() FileTabSet.set_pos("150", "9%") FileTabSet.set_size("100%-150", "100%-160") @@ -396,7 +396,7 @@ class UIDE : Dialog( FileTabSet.add(tab_item_2) FileTabSet.set_which_one(tab_item_2) self.add(FileTabSet) - + ClassTabSet := BufferTabSet() ClassTabSet.set_pos("0", "9%") ClassTabSet.set_size("150", "100%-160") @@ -412,7 +412,7 @@ class UIDE : Dialog( ClassTabSet.add(tab_item_3) ClassTabSet.set_which_one(tab_item_3) self.add(ClassTabSet) - + pnlToolbar := Panel() pnlToolbar.set_pos("0", "4.5%") pnlToolbar.set_size("100%", "4.5%") diff --git a/uni/ide/uproject.icn b/uni/ide/uproject.icn index a90bedf59..00a616d01 100644 --- a/uni/ide/uproject.icn +++ b/uni/ide/uproject.icn @@ -19,7 +19,7 @@ global filedirectory # class UProject : Dialog(filesAdd_btn, filesDel_btn, sourcefiles_list, Utargetfile, projectname, - Makefile_name, compilerName, compilerflags, + Makefile_name, compilerName, compilerflags, linkerName, linkerflags, targetFile_name, selectedfile, uproj_TabSet, files_tab, fileslist, fileslist1, prjPath, filesloclist, UIDE_VERS, makeName, cc, ld, wcc, wld, lFlags, @@ -39,7 +39,7 @@ class UProject : Dialog(filesAdd_btn, filesDel_btn, pname := file_name(projectname) if find(".uprj"|".icn", projectname) then - projectname := file_name(projectname) + projectname := file_name(projectname) #else projectname := pname Makefile_name.set_contents(projectname || "_uprjMakefile") @@ -90,17 +90,17 @@ $endif # Append a trailing slash, but only if one isn't there already. if not any('/\\', filedirectory[-1]) then { $ifdef _UNIX - filedirectory ||:= "/" + filedirectory ||:= "/" $else - filedirectory ||:= "\\" + filedirectory ||:= "\\" $endif - } + } pathname := filedirectory||projectname||"_Makefile" if not (f := open(pathname, "w")) then { - write(&errout, "could not open/write ", image(pathname)) - fail - } + write(&errout, "could not open/write ", image(pathname)) + fail + } write(f,"#", repl("=",55)) writes(f,"#@V@:Note: File automatically generated by UI IDE ") @@ -114,29 +114,29 @@ $endif getUFiles(f) write(f,"\n\nall: order\n") #clean - write(f,"clean:") + write(f,"clean:") write(f,"\t$(DEL) $(UFILES) uniclass.* *~ ", projectname) write(f) #deps - write(f,"deps:") + write(f,"deps:") writes(f,"\tunidep ") - every writes(f,file_name(!fileslist), " ") + every writes(f,file_name(!fileslist), " ") write(f,"\n") #order - writes(f,"order: ") - every file := map(!fileslist) do { + writes(f,"order: ") + every file := map(!fileslist) do { writes(f,file_name(file[-3:-(*file)])||"u ") - } + } write(f) writes(f,"\t$(UC) -o UProject ") - every file := map(!fileslist) do { + every file := map(!fileslist) do { writes(f,file_name(file[-3:-(*file)])||"u ") - } + } write(f,"\n") #compilation - write(f,"%.u: %.icn") - write(f,"\t$(UC) -c $*") + write(f,"%.u: %.icn") + write(f,"\t$(UC) -c $*") close(f) end @@ -150,7 +150,7 @@ $endif local file every file := map(!fileslist) do { writes(f, " ", file_name(file[1:*file-3]), ".u") - } + } end # @@ -171,7 +171,7 @@ $endif inputstr := dialog_value[1] &window := oldwindow return inputstr - end + end method on_filesAdd(ev) files_added +:= 1 @@ -193,9 +193,9 @@ $endif end method setup() - local files_tab, names_lbl1, names_lbl2, names_lbl3, names_lbl4, + local files_tab, names_lbl1, names_lbl2, names_lbl3, names_lbl4, names_lbl5, names_lbl6, names_tab, ok_btn, sourcefiles_lbl - self.set_attribs("size=414,308", "font=serif,bold,14", + self.set_attribs("size=414,308", "font=serif,bold,14", "label=New Unicon Project ", "bg=light gray") uproj_TabSet := TabSet() uproj_TabSet.set_pos("5", "5") diff --git a/uni/ide/utags.icn b/uni/ide/utags.icn index 7bc3041e0..869d58039 100644 --- a/uni/ide/utags.icn +++ b/uni/ide/utags.icn @@ -28,31 +28,31 @@ procedure utags(contents, parentfile) line[find("//",line):0] := "" line ? { - gword := getword3(line) + gword := getword3(line) ### Unicon Tags ### - if find(".icn", parentfile) then { #Unicon Tags - gword := getword() - tab(many(' ')) - - case gword of { - "procedure"|"class": { - put(outlines, Tag(gword, getword(), lineno, parentfile)) - } - "method": { - outlines[-1].add(Tag(gword, getword(), lineno,parentfile)) - } - "initially": { - outlines[-1].add(Tag(gword,gword,lineno,parentfile)) - } - "link"|"$include"|"package": { - every word := getword() do - put(outlines, Tag(gword, word, lineno, parentfile) ) - } - } - } - lineno +:= 1 - } + if find(".icn", parentfile) then { #Unicon Tags + gword := getword() + tab(many(' ')) + + case gword of { + "procedure"|"class": { + put(outlines, Tag(gword, getword(), lineno, parentfile)) + } + "method": { + outlines[-1].add(Tag(gword, getword(), lineno,parentfile)) + } + "initially": { + outlines[-1].add(Tag(gword,gword,lineno,parentfile)) + } + "link"|"$include"|"package": { + every word := getword() do + put(outlines, Tag(gword, word, lineno, parentfile) ) + } + } + } + lineno +:= 1 + } } return outlines end @@ -81,13 +81,13 @@ procedure getword3(line) local i, c, ch1 := 0, ch2, index1, index2, word # -# returns the index of the location of +# returns the index of the location of # '(' or '{' in the method header. # index2 := upto('({', line) # - # returns the index of the location of + # returns the index of the location of # the first blank before the method name. # i := \index2-2 @@ -95,7 +95,7 @@ local i, c, ch1 := 0, ch2, index1, index2, word i -:= 1 index1 := i - word := line[\index1:\index2] + word := line[\index1:\index2] suspend word end @@ -109,21 +109,21 @@ global Tags procedure main(args) local i, lines, d, name, l, temp - + Tags := [] lines := [] l := [] - + while *args > 0 do { name := pop(args) if not (i := open(name,"r")) then - stop("utags: couldn't open ", image(name)) + stop("utags: couldn't open ", image(name)) while put(lines, read(i)) close(i) l := utags(lines) temp := Tag("file",name, 0) - every i := ! l do temp.add(i) + every i := ! l do temp.add(i) put(Tags, temp) lines := [] @@ -139,31 +139,31 @@ class dialog : _Dialog(class_browser) method handle_default(ev) end - + method dialog_event(ev) case ev.get_component() of { class_browser : handle_class_browser(ev) default : handle_default(ev) - } + } end - + method setup() local nodes, names, i, j - + self.set_attribs("size=500,600", "bg=pale gray") self.min_width := 200 self.min_height := 200 - + class_browser := ClassBrowser() class_browser$set_pos("5", "5") class_browser$set_size("100%-10", "100%-10") class_browser$set_attribs("bg=white","font=sans,18", - "label=Unicon Class File Browser", "resize=on") - + "label=Unicon Class File Browser", "resize=on") + class_browser$filltree(Tags) self$add(class_browser) end - + method component_setup() self.setup() end diff --git a/uni/ide/verifymake.icn b/uni/ide/verifymake.icn index 799e5de60..7331ce828 100644 --- a/uni/ide/verifymake.icn +++ b/uni/ide/verifymake.icn @@ -3,19 +3,19 @@ import gui $include "guih.icn" $ifdef _MS_WINDOWS_NT -$define CMD "where make.exe >null" +$define CMD "where make.exe >null" $define URL "http://sourceforge.net/projects/gnuwin32/files/make/3.81/" $else -$define CMD "which make >/dev/null" +$define CMD "which make >/dev/null" $define URL "http://sourceforge.net/projects/gmsl/" -$endif +$endif procedure verify_make() local m, check check := system(CMD) if check = 0 then return else m := VerifyMakeDlg(); m.show_modal() - if /m.quit_true then return + if /m.quit_true then return end class VerifyMakeDlg : Dialog( @@ -35,7 +35,7 @@ class VerifyMakeDlg : Dialog( pos_x := tab(find(",")) ="," pos_y := tab(many('-0123456789')) - } + } if /pos_x then pos_x := 0 else pos_x +:= 0.40 * WAttrib("width") if /pos_y then pos_y:=0 @@ -98,7 +98,7 @@ class VerifyMakeDlg : Dialog( lbl_warning_pt3.set_size(400, 20) lbl_warning_pt3.set_internal_alignment("l") lbl_warning_pt3.set_label("Gnu make facility is availble for download at:") - self.add(lbl_warning_pt3) + self.add(lbl_warning_pt3) lbl_url := Label() lbl_url.set_pos(20, 86) lbl_url.set_size(400, 20) diff --git a/uni/ide/wu.icn b/uni/ide/wu.icn index fd24e299b..b1a7777ba 100644 --- a/uni/ide/wu.icn +++ b/uni/ide/wu.icn @@ -1,12 +1,12 @@ ########################################################################### # -# File: wu.icn +# File: wu.icn # -# Subject: Program environment for Windows Unicon +# Subject: Program environment for Windows Unicon # -# Author: Clinton L. Jeffery +# Author: Clinton L. Jeffery # -# Date: June 12, 2000 +# Date: June 12, 2000 # ############################################################################ # @@ -14,10 +14,10 @@ # It is gradually gaining features and usability. # # To do: -# keyboard shortcuts -# multiple edit regions. Also, edit regions > Windows' 32K limit. -# UNIX port, or equivalent -# +# keyboard shortcuts +# multiple edit regions. Also, edit regions > Windows' 32K limit. +# UNIX port, or equivalent +# ############################################################################ # # Requires: Version 9 graphics, MS Windows extensions @@ -32,21 +32,21 @@ link graphics, io global menu, - current_file, - project, - icodename, - xargs, - targs, - height, - width, - font, - fontheight, - msglines, - linebreak, - findstr, - findpos, - wiconlog, - wi_ini + current_file, + project, + icodename, + xargs, + targs, + height, + width, + font, + fontheight, + msglines, + linebreak, + findstr, + findpos, + wiconlog, + wi_ini # # appendmessage(s) - add message to end of message window contents @@ -57,7 +57,7 @@ procedure appendmessage(s, nonl) if /nonl then nonl := "\r\n" else nonl := "" WinEditRegion("messagewin", s2 || nonl || s, 0, height - (fontheight * (msglines + 2))) WinEditRegion("editregion", &null, 0, 0, - width, height - (fontheight * (msglines + 2))) + width, height - (fontheight * (msglines + 2))) end # @@ -95,22 +95,22 @@ procedure complink() while menu[1][i] ~== "E&xit" do i +:= 1 i +:= 1 while menu[1][i] do { - arglist ||:= comp1file(menu[1][i]) - arglist ||:= " " - i +:= 1 - } + arglist ||:= comp1file(menu[1][i]) + arglist ||:= " " + i +:= 1 + } if find(".icn", arglist) then { - system("wiconx unicon -quiet -log " || wiconlog || " -c " || targs || " " || arglist, log) - - every 1 to 5 do { - if f := open(wiconlog) then { - close(f) - log := readin(wiconlog) - if showanyerror(log) then fail - break - } - delay(1000) - } + system("wiconx unicon -quiet -log " || wiconlog || " -c " || targs || " " || arglist, log) + + every 1 to 5 do { + if f := open(wiconlog) then { + close(f) + log := readin(wiconlog) + if showanyerror(log) then fail + break + } + delay(1000) + } } # build a list of all the files to be linked together @@ -119,13 +119,13 @@ procedure complink() while menu[1][i] ~== "E&xit" do i +:= 1 i +:= 1 while menu[1][i] do { - s := menu[1][i] + s := menu[1][i] s[find(".icn", map(s)) : 0] := ".u" - if s[1] ~== "-" & (not find(".", s)) then s ||:= ".u" - arglist ||:= s - arglist ||:= " " - i +:= 1 - } + if s[1] ~== "-" & (not find(".", s)) then s ||:= ".u" + arglist ||:= s + arglist ||:= " " + i +:= 1 + } } system("wiconx unicon -quiet -log " || wiconlog || " -o " || quotes(icodename) || " " || targs || " " || arglist, log) @@ -140,7 +140,7 @@ end procedure defextension(s) s ? { if tab(find(".")+1) & (tab(many(&letters++&digits))|"") & pos(0) then - return s + return s else return s ||:= ".icn" } end @@ -153,8 +153,8 @@ procedure findstring(s, i) s2 := WinEditRegion("editregion") s2 ? { if findpos := find(s, , i + 1) then { - WinEditRegion("editregion", "!setsel", findpos, findpos + *s) - } + WinEditRegion("editregion", "!setsel", findpos, findpos + *s) + } } end @@ -162,8 +162,8 @@ procedure gotoline(i) s2 := WinEditRegion("editregion") s2 ? { every i := 1 to i - 1 do { - tab(find("\n")+1) | fail - } + tab(find("\n")+1) | fail + } j := &pos tab(find("\n")+1) | fail WinEditRegion("editregion", "!setsel", j, &pos) @@ -182,35 +182,35 @@ procedure main(av) pop(av) } &window := open("Wu","g", "size="||width||","||height, "font="||font, - "resize=on") + "resize=on") fontheight := WAttrib("fheight") menu := [ - ["&File", "&New", "&Open...", "&Print", "&Save", "Save &As...", "&IVIB", "E&xit"], - ["&Edit", "C&opy", "&Cut", "&Paste", "&Select All", - "&Find...", "Find &Next", "&Replace...", "&Goto line...", - "&Match parentheses", - "&Undo" # , "Show &Next Error" # not yet - ], - ["&Options", "&Message window size...", "&Font...", - "Use &DOS (CR-LF) line breaks when saving", - "Use &UNIX (LF) newlines when saving", - "&Save options"], - ["&Compile", "&Make (compile + link) executable", - "&Compile only", - # "Make &Everything", - "&Graphics (Win32) binary (= -G)", - "&NT (console mode) binary", - "Compiler &Options..."], - ["&Run", "&Run", "&Arguments..."], - ["&Help", "&Wu Programming Environment", - "Icon &Tutorial Overview", - "Icon &Language Reference", - "I&dol Reference", - "Icon &Graphics Facilities Reference", - "Icon &Program Library Reference", - "&Visual Interface Builder Reference", - "&Frequently Asked Questions", - "&About..."]] + ["&File", "&New", "&Open...", "&Print", "&Save", "Save &As...", "&IVIB", "E&xit"], + ["&Edit", "C&opy", "&Cut", "&Paste", "&Select All", + "&Find...", "Find &Next", "&Replace...", "&Goto line...", + "&Match parentheses", + "&Undo" # , "Show &Next Error" # not yet + ], + ["&Options", "&Message window size...", "&Font...", + "Use &DOS (CR-LF) line breaks when saving", + "Use &UNIX (LF) newlines when saving", + "&Save options"], + ["&Compile", "&Make (compile + link) executable", + "&Compile only", + # "Make &Everything", + "&Graphics (Win32) binary (= -G)", + "&NT (console mode) binary", + "Compiler &Options..."], + ["&Run", "&Run", "&Arguments..."], + ["&Help", "&Wu Programming Environment", + "Icon &Tutorial Overview", + "Icon &Language Reference", + "I&dol Reference", + "Icon &Graphics Facilities Reference", + "Icon &Program Library Reference", + "&Visual Interface Builder Reference", + "&Frequently Asked Questions", + "&About..."]] WinMenuBar ! menu | stop("wi: menu bar failed") WinEditRegion("messagewin", "", 0, height - (fontheight * (msglines + 2))) if av[1] then openfile(av[1]) @@ -221,167 +221,167 @@ end procedure mainloop() while e := Event() do case e of { - "&Find...": { - if TextDialog("Enter string to seek: ",,xargs,60)=="Okay" then { - findstr := dialog_value[1] - findstring(findstr) - } - } - "Find &Next": { - findstring(\findstr, findpos) - } - "&Replace...": { - if TextDialog("Replace what with what: ",, - [(\findstr | ""),""],60)=="Okay" then { - wu_replace(dialog_value[1], dialog_value[2]) - } - } - "&Arguments...": { - if TextDialog("Enter command line arguments: ",,xargs,60)=="Okay" then - xargs := dialog_value[1] - } - "Compiler &Options...": { - if TextDialog("Enter compiler options: ",,targs,60)=="Okay" then - targs := dialog_value[1] - } - "&Message window size...": { - if TextDialog("Enter # of lines for the message window: ",,msglines,60)=="Okay" then { - msglines := dialog_value[1] - resize() - } - } - "Use &DOS (CR-LF) line breaks when saving": { - linebreak := "CRLF" - } - "Use &UNIX (LF) newlines when saving": { - linebreak := "LF" - } - "&Font..." : { - /font := Font() - if font := WinFontDialog(font) then { - Font(font) - fontheight := WAttrib("fheight") - WinEditRegion("messagewin", "!font=" || font) - WinEditRegion("editregion", "!font=" || font) - } - } - "&Save options": { - wi_saveoptions() - } - "C&opy" : { - WinEditRegion("editregion", "!copy", 0, 0, - width, height - (fontheight * (msglines + 2))) - } - "&Cut" : { - WinEditRegion("editregion", "!cut", 0, 0, - width, height - (fontheight * (msglines + 2))) - } - "&Paste" : { - WinEditRegion("editregion", "!paste", 0, 0, - width, height - (fontheight * (msglines + 2))) - } - "&Goto line..." : { - if TextDialog("What line shall we go to?",,"",6)=="Okay" then { - gotoline(integer(dialog_value[1])) - } - } - "&Match parentheses" : { - i := WinEditRegion("editregion","!getsel",0,0, - width, height - (fontheight * (msglines + 2))) | - stop("can't get selection") - message("i " || image(i)) - s := WinEditRegion("editregion") || " " - if s[i] == ( "(" | "{" | "[" ) then { - every j := (bal(,s[i],map(s[i],"({[",")}]"),s,i) \ 2) - if j > i then WinEditRegion("editregion","!setsel",i,j) - } - else if s[i-1] == (")"|"}"|"]") then { - every j := (bal(,s[i-1],map(s[i-1],")}]","({["), - reverse(s[1:i])||" ") \ 2) - if j > 1 then WinEditRegion("editregion","!setsel",i-(j-1),i) - } - } - "&Undo" : { - WinEditRegion("editregion", "!undo", 0, 0, - width, height - (fontheight * (msglines + 2))) - } - "&Select All" : { - WinEditRegion("editregion", "!setsel", 1, 0) - } - "&New": { - openfile("noname.icn") - WinEditRegion("editregion", "", 0, 0, width, height-(fontheight * (msglines + 2))) - message("creating new file") - } - "&Open..." : { - openfile() - } - "&Print" : { - printfile() - } - "&Save" : { - save() - } - "Save &As..." : { - saveas() - } - "&Compile only": { - save() - compile() - } - "&IVIB": { - openfile(current_file) - system("ivib.exe "|| current_file) | - write("system failed") - openfile(current_file) - } - "&Make (compile + link) executable": { - save() - complink() - } - "&Run": run() - "E&xit" : exit(0) - "Icon &Language Reference": - system("winhelp iconref.hlp &") - "Icon &Graphics Facilities Reference": - system("winhelp gipd.hlp &") - "&Wu Programming Environment": - system("winhelp ipd271.hlp &") - "Icon &Tutorial Overview": - system("winhelp iconintr.hlp &") - "Icon &Program Library Reference": - system("winhelp iplref.hlp &") - "&Frequently Asked Questions": - system("winhelp iconfaq.hlp &") - "&Visual Interface Builder Reference": - system("winhelp ipd284.hlp &") - "&About...": { - Notice("Windows " || &version, - "Wu version 1.03 BETA", - "Clint Jeffery, jeffery@cs.uidaho.edu", - "Department of Computer Science", - "University of Idaho") - } - &resize: { - width := &x - height := &y - resize() - } - default: { - if e == !(menu[1]) then { # open file in the current project - openfile(e) - } - else { - appendmessage("dropping extraneous event: " || image(e)) - } - } - } + "&Find...": { + if TextDialog("Enter string to seek: ",,xargs,60)=="Okay" then { + findstr := dialog_value[1] + findstring(findstr) + } + } + "Find &Next": { + findstring(\findstr, findpos) + } + "&Replace...": { + if TextDialog("Replace what with what: ",, + [(\findstr | ""),""],60)=="Okay" then { + wu_replace(dialog_value[1], dialog_value[2]) + } + } + "&Arguments...": { + if TextDialog("Enter command line arguments: ",,xargs,60)=="Okay" then + xargs := dialog_value[1] + } + "Compiler &Options...": { + if TextDialog("Enter compiler options: ",,targs,60)=="Okay" then + targs := dialog_value[1] + } + "&Message window size...": { + if TextDialog("Enter # of lines for the message window: ",,msglines,60)=="Okay" then { + msglines := dialog_value[1] + resize() + } + } + "Use &DOS (CR-LF) line breaks when saving": { + linebreak := "CRLF" + } + "Use &UNIX (LF) newlines when saving": { + linebreak := "LF" + } + "&Font..." : { + /font := Font() + if font := WinFontDialog(font) then { + Font(font) + fontheight := WAttrib("fheight") + WinEditRegion("messagewin", "!font=" || font) + WinEditRegion("editregion", "!font=" || font) + } + } + "&Save options": { + wi_saveoptions() + } + "C&opy" : { + WinEditRegion("editregion", "!copy", 0, 0, + width, height - (fontheight * (msglines + 2))) + } + "&Cut" : { + WinEditRegion("editregion", "!cut", 0, 0, + width, height - (fontheight * (msglines + 2))) + } + "&Paste" : { + WinEditRegion("editregion", "!paste", 0, 0, + width, height - (fontheight * (msglines + 2))) + } + "&Goto line..." : { + if TextDialog("What line shall we go to?",,"",6)=="Okay" then { + gotoline(integer(dialog_value[1])) + } + } + "&Match parentheses" : { + i := WinEditRegion("editregion","!getsel",0,0, + width, height - (fontheight * (msglines + 2))) | + stop("can't get selection") + message("i " || image(i)) + s := WinEditRegion("editregion") || " " + if s[i] == ( "(" | "{" | "[" ) then { + every j := (bal(,s[i],map(s[i],"({[",")}]"),s,i) \ 2) + if j > i then WinEditRegion("editregion","!setsel",i,j) + } + else if s[i-1] == (")"|"}"|"]") then { + every j := (bal(,s[i-1],map(s[i-1],")}]","({["), + reverse(s[1:i])||" ") \ 2) + if j > 1 then WinEditRegion("editregion","!setsel",i-(j-1),i) + } + } + "&Undo" : { + WinEditRegion("editregion", "!undo", 0, 0, + width, height - (fontheight * (msglines + 2))) + } + "&Select All" : { + WinEditRegion("editregion", "!setsel", 1, 0) + } + "&New": { + openfile("noname.icn") + WinEditRegion("editregion", "", 0, 0, width, height-(fontheight * (msglines + 2))) + message("creating new file") + } + "&Open..." : { + openfile() + } + "&Print" : { + printfile() + } + "&Save" : { + save() + } + "Save &As..." : { + saveas() + } + "&Compile only": { + save() + compile() + } + "&IVIB": { + openfile(current_file) + system("ivib.exe "|| current_file) | + write("system failed") + openfile(current_file) + } + "&Make (compile + link) executable": { + save() + complink() + } + "&Run": run() + "E&xit" : exit(0) + "Icon &Language Reference": + system("winhelp iconref.hlp &") + "Icon &Graphics Facilities Reference": + system("winhelp gipd.hlp &") + "&Wu Programming Environment": + system("winhelp ipd271.hlp &") + "Icon &Tutorial Overview": + system("winhelp iconintr.hlp &") + "Icon &Program Library Reference": + system("winhelp iplref.hlp &") + "&Frequently Asked Questions": + system("winhelp iconfaq.hlp &") + "&Visual Interface Builder Reference": + system("winhelp ipd284.hlp &") + "&About...": { + Notice("Windows " || &version, + "Wu version 1.03 BETA", + "Clint Jeffery, jeffery@cs.uidaho.edu", + "Department of Computer Science", + "University of Idaho") + } + &resize: { + width := &x + height := &y + resize() + } + default: { + if e == !(menu[1]) then { # open file in the current project + openfile(e) + } + else { + appendmessage("dropping extraneous event: " || image(e)) + } + } + } end procedure message(s) WinEditRegion("messagewin", s, 0, height - (fontheight * (msglines + 2))) WinEditRegion("editregion", &null, 0, 0, - width, height - (fontheight * (msglines + 2))) + width, height - (fontheight * (msglines + 2))) end procedure monthval(s) @@ -405,7 +405,7 @@ end # is t1 newer than t2? procedure newer(s1, s2) local month, day, year, hour, minute, second, - month2, day2, year2, hour2, minute2, second2 + month2, day2, year2, hour2, minute2, second2 if map(s1|s2) == "util.icn" then Notice("s1 " || s1 || " s2 "||s2) t1 := stat(s1).mtime | fail if map(s1|s2) == "util.icn" then Notice("s1 " || s1 || " t1 "||t1) @@ -461,85 +461,85 @@ end procedure openfile(s) oldfilnam := current_file if WinEditRegion("editregion", "!modified", 0, 0, - width, height - (fontheight * (msglines + 2))) then { + width, height - (fontheight * (msglines + 2))) then { case SelectDialog(current_file || " is modified, save it?",,, - ["Yes", "Save As", "No", "Cancel"]) of { - "Yes": { - save() - } - "Save As": { - saveas() - } - "Cancel": { - fail - } - } + ["Yes", "Save As", "No", "Cancel"]) of { + "Yes": { + save() + } + "Save As": { + saveas() + } + "Cancel": { + fail + } + } } if current_file := (\s | ((OpenDialog("Open Source File", "noname.icn", 50, fileextensions()) == "Okay") & \dialog_value)) then { if find(".icp", map(current_file)) then { # open project - project := current_file - updateproject() - } + project := current_file + updateproject() + } else { # open a source file - current_file := defextension(current_file) - if \project then { - tmps := current_file - # probably should only delete the prefix of the project here - while tmps[1:find("\\",tmps)+1] := "" - if not find(map(tmps), map(!(menu[1]))) then { - # opened file not in project, add it, or switch out - # of project mode? - case SelectDialog(current_file || " is not in the project",,, - ["Add it", "Open it", "Cancel"]) of { - "Add it": { - f := open(project, "w") | - stop("can't write to project ", project) - put(menu[1], current_file) - i := 1 - while menu[1][i] ~== "E&xit" do i +:= 1 - i +:= 1 - while menu[1][i] do { - write(f, menu[1][i]) - i +:= 1 - } - close(f) - WinMenuBar ! menu - } - "Open it": { - project := &null - icodename := current_file - icodename[find(".icn"|".ICN", icodename) : 0] := "" - while menu[1][-1] ~== "E&xit" do pull(menu[1]) - WinMenuBar ! menu - } - "Cancel": { - current_file := oldfilnam - fail - } - } - } - } + current_file := defextension(current_file) + if \project then { + tmps := current_file + # probably should only delete the prefix of the project here + while tmps[1:find("\\",tmps)+1] := "" + if not find(map(tmps), map(!(menu[1]))) then { + # opened file not in project, add it, or switch out + # of project mode? + case SelectDialog(current_file || " is not in the project",,, + ["Add it", "Open it", "Cancel"]) of { + "Add it": { + f := open(project, "w") | + stop("can't write to project ", project) + put(menu[1], current_file) + i := 1 + while menu[1][i] ~== "E&xit" do i +:= 1 + i +:= 1 + while menu[1][i] do { + write(f, menu[1][i]) + i +:= 1 + } + close(f) + WinMenuBar ! menu + } + "Open it": { + project := &null + icodename := current_file + icodename[find(".icn"|".ICN", icodename) : 0] := "" + while menu[1][-1] ~== "E&xit" do pull(menu[1]) + WinMenuBar ! menu + } + "Cancel": { + current_file := oldfilnam + fail + } + } + } + } else { - icodename := current_file + icodename := current_file icodename[find(".icn", map(icodename)) : 0] := "" - } + } } if s := readin(current_file) then { - i := 0 - every find("\n", s) do i +:=1 - WinEditRegion("editregion", s, 0, 0, width, height - (fontheight * (msglines + 2))) - message("opened " || current_file || ", " || i || " lines, " || *s || " characters") - setlabel() - return - } + i := 0 + every find("\n", s) do i +:=1 + WinEditRegion("editregion", s, 0, 0, width, height - (fontheight * (msglines + 2))) + message("opened " || current_file || ", " || i || " lines, " || *s || " characters") + setlabel() + return + } } else { if /current_file then { - WinEditRegion("editregion", "# wi won't you please open a file?", 0, 0, - width, height - (fontheight * (msglines + 2))) - } + WinEditRegion("editregion", "# wi won't you please open a file?", 0, 0, + width, height - (fontheight * (msglines + 2))) + } } end @@ -568,9 +568,9 @@ procedure readin(fname) s2 := "" s ? { while s2 ||:= tab(find("\n")) do { - if s2[*s2] ~== "\r" then s2 ||:= "\r" - s2 ||:= move(1) - } + if s2[*s2] ~== "\r" then s2 ||:= "\r" + s2 ||:= move(1) + } s3 := tab(0) if *s3 > 0 then s2 ||:= s3 } @@ -584,25 +584,25 @@ procedure wu_replace(s1, s2) while findpos := find(s1, s3, i + 1) do { WinEditRegion("editregion", "!setsel", findpos, findpos + *s1) case \yes | SelectDialog("replace "||s1||" with "||s2|| " ?",,, - ["Yes", "Yes to All", "No", "Cancel"]) of { - "Yes": { - s3[findpos : findpos + *s1] := s2 - i := findpos + *s2 - WinEditRegion("editregion", s3) - } - "Yes to All": { - yes := "Yes to All" - s3[findpos : findpos + *s1] := s2 - i := findpos + *s2 - WinEditRegion("editregion", s3) - } - "No": { - i := findpos + 1 - } - "Cancel": { - fail - } - } + ["Yes", "Yes to All", "No", "Cancel"]) of { + "Yes": { + s3[findpos : findpos + *s1] := s2 + i := findpos + *s2 + WinEditRegion("editregion", s3) + } + "Yes to All": { + yes := "Yes to All" + s3[findpos : findpos + *s1] := s2 + i := findpos + *s2 + WinEditRegion("editregion", s3) + } + "No": { + i := findpos + 1 + } + "Cancel": { + fail + } + } } end @@ -611,37 +611,37 @@ procedure resize() s2 := WinEditRegion("messagewin") WinEditRegion("messagewin", s2, 0, height - (fontheight * (msglines + 2))) WinEditRegion("editregion", &null, 0, 0, - width, height - (fontheight * (msglines + 2))) + width, height - (fontheight * (msglines + 2))) end procedure run() if s := \wiconlog then { if system( # "wiconx " || - icodename || " " || xargs) then { - s := readin(s) - showanyerror(s) - } + icodename || " " || xargs) then { + s := readin(s) + showanyerror(s) + } else { - s := "system(" || # wiconx " || - icodename || " " || xargs || - ") failed. Is the PATH setup to run this?" - showanyerror(s) - } + s := "system(" || # wiconx " || + icodename || " " || xargs || + ") failed. Is the PATH setup to run this?" + showanyerror(s) + } } else { if system( # "wiconx " || - icodename || " " || xargs) then { - s := # "wiconx " || - icodename || " " || xargs || " completed.\r\n" || - "Set your WICONLOG variable for better error support; see Help." - showanyerror(s) - } + icodename || " " || xargs) then { + s := # "wiconx " || + icodename || " " || xargs || " completed.\r\n" || + "Set your WICONLOG variable for better error support; see Help." + showanyerror(s) + } else { - s := # "wiconx " || - icodename || " " || xargs || " ... failed.\r\n" || - "Set your WICONLOG variable for better error support; see Help." - showanyerror(s) - } + s := # "wiconx " || + icodename || " " || xargs || " ... failed.\r\n" || + "Set your WICONLOG variable for better error support; see Help." + showanyerror(s) + } } end @@ -652,25 +652,25 @@ procedure save(evenifnotmodified) return } if \evenifnotmodified | WinEditRegion("editregion", "!modified", 0, 0, - width, height - (fontheight * (msglines + 2))) then { + width, height - (fontheight * (msglines + 2))) then { s := WinEditRegion("editregion") if linebreak === "LF" then - while s[find("\^m\n", s)] := "" + while s[find("\^m\n", s)] := "" if file := open(current_file, "wu") then { - writes(file, s) - close(file) - if current_file === project then updateproject() - i := 0 - every find("\n", s) do i +:=1 - message("saved " || current_file || ", " || i || " lines, " || *s || " characters") - # reset the modified flag in the edit region - WinEditRegion("editregion", "!modified=0", 0, 0, - width, height - (fontheight * (msglines + 2))) - return - } + writes(file, s) + close(file) + if current_file === project then updateproject() + i := 0 + every find("\n", s) do i +:=1 + message("saved " || current_file || ", " || i || " lines, " || *s || " characters") + # reset the modified flag in the edit region + WinEditRegion("editregion", "!modified=0", 0, 0, + width, height - (fontheight * (msglines + 2))) + return + } else { - Notice("Can't save " || current_file) - } + Notice("Can't save " || current_file) + } } end @@ -679,10 +679,10 @@ procedure fileextensions() static eL initial { eL := [ - "Unicon Sources(*.icn)|*.icn", - "Unicon Projects(*.icp)|*.icp", - "All Files(*.*)|*.*" - ] + "Unicon Sources(*.icn)|*.icn", + "Unicon Projects(*.icp)|*.icp", + "All Files(*.*)|*.*" + ] } /current_file := "noname.icn" @@ -699,21 +699,21 @@ procedure saveas() if s := WinSaveDialog("Save File As...", ,50, fileextensions()) then { s := defextension(s) if \project then { - if (not find(s, !menu[1])) & find(".icn"|".u",s) then { - put(menu[1], s) - WinMenuBar ! menu - } - } + if (not find(s, !menu[1])) & find(".icn"|".u",s) then { + put(menu[1], s) + WinMenuBar ! menu + } + } if match(icodename, current_file) then { - icodename := s + icodename := s icodename[find(".icn", map(icodename)) : 0] := "" } current_file := s save(1) if find(".icp", map(current_file)) then { # open project - project := current_file - updateproject() - } + project := current_file + updateproject() + } setlabel() } end @@ -729,19 +729,19 @@ procedure showanyerror(s) s := WinEditRegion("messagewin") || "\r\n" || trim(s, '\r\n \t') WinEditRegion("messagewin", s, 0, height - (fontheight * (msglines + 2))) s ? { - if tab(find("File ")+5) & fn := tab(find(";")) & - ="; Line " & ln := integer(tab(many(&digits))) then { - if map(fn) ~== map(current_file) then + if tab(find("File ")+5) & fn := tab(find(";")) & + ="; Line " & ln := integer(tab(many(&digits))) then { + if map(fn) ~== map(current_file) then if not openfile(fn) then return - else appendmessage(s) - gotoline(ln) - return - } - else - WinEditRegion("editregion", &null, 0, 0, - width, height - (fontheight * (msglines + 2))) - if find("cannot") then return - } + else appendmessage(s) + gotoline(ln) + return + } + else + WinEditRegion("editregion", &null, 0, 0, + width, height - (fontheight * (msglines + 2))) + if find("cannot") then return + } end procedure system(s, apnd) @@ -763,8 +763,8 @@ procedure updateproject() icodename[find(".icp", map(icodename)) : 0] := "" if f := open(project) then { while s := trim(read(f), '\^m') do { - put(menu[1], defextension(s)) - } + put(menu[1], defextension(s)) + } close(f) } WinMenuBar ! menu @@ -774,10 +774,10 @@ procedure wi_saveoptions() local f if f := open(wi_ini,"w") then { write(f, "width=",width,"\n", - "height=",height,"\n", - "msglines=",msglines,"\n", - "font=",font,"\n", - "linebreak=",linebreak) + "height=",height,"\n", + "msglines=",msglines,"\n", + "font=",font,"\n", + "linebreak=",linebreak) } else { } @@ -792,29 +792,29 @@ procedure wi_initialize() linebreak := "CRLF" if f := open(wi_ini) then { while line := read(f) do { - line ? { - if ="msglines" then { - tab(upto(&digits)) - msglines := integer(tab(many(&digits))) - } - else if ="height" then { - tab(upto(&digits)) - height := integer(tab(many(&digits))) - } - else if ="width" then { - tab(upto(&digits)) - width := integer(tab(many(&digits))) - } - else if ="font" then { - tab(many('= \t')) - font := tab(0) - } - else if ="linebreak" then { - tab(many('= \t')) - linebreak := tab(0) - } - } - } + line ? { + if ="msglines" then { + tab(upto(&digits)) + msglines := integer(tab(many(&digits))) + } + else if ="height" then { + tab(upto(&digits)) + height := integer(tab(many(&digits))) + } + else if ="width" then { + tab(upto(&digits)) + width := integer(tab(many(&digits))) + } + else if ="font" then { + tab(many('= \t')) + font := tab(0) + } + else if ="linebreak" then { + tab(many('= \t')) + linebreak := tab(0) + } + } + } close(f) } end From c80c0488362bdcd989a28a096a15e27118dca5e3 Mon Sep 17 00:00:00 2001 From: Don Ward Date: Sun, 10 Mar 2024 13:23:08 +0000 Subject: [PATCH 4/7] Convert tabs to spaces (uni/lib). --- uni/lib/_image.icn | 12 +- uni/lib/basicclasscoding.icn | 2 +- uni/lib/blockread.icn | 34 ++-- uni/lib/checkbox.icn | 2 +- uni/lib/cltable.icn | 16 +- uni/lib/component.icn | 4 +- uni/lib/compoundedit.icn | 4 +- uni/lib/connectable.icn | 102 ++++++------ uni/lib/contentdisposition.icn | 6 +- uni/lib/contenttype.icn | 8 +- uni/lib/database.icn | 28 ++-- uni/lib/dispatcher.icn | 12 +- uni/lib/doptions.icn | 74 ++++----- uni/lib/exception.icn | 32 ++-- uni/lib/fcn_util.icn | 44 ++--- uni/lib/file_dlg.icn | 44 ++--- uni/lib/genserve.icn | 228 ++++++++++++------------- uni/lib/gui.icn | 42 ++--- uni/lib/guiconst.icn | 18 +- uni/lib/heap.icn | 22 +-- uni/lib/iconbutton.icn | 4 +- uni/lib/json.icn | 186 ++++++++++----------- uni/lib/langprocs.icn | 8 +- uni/lib/mapbytes.icn | 32 ++-- uni/lib/matrix_util.icn | 46 +++--- uni/lib/misc_util.icn | 38 ++--- uni/lib/msgutils.icn | 286 ++++++++++++++++---------------- uni/lib/notifier.icn | 34 ++-- uni/lib/object.icn | 18 +- uni/lib/pqueue.icn | 24 +-- uni/lib/rfc822pr.icn | 8 +- uni/lib/scan_util.icn | 26 +-- uni/lib/soap_util.icn | 68 ++++---- uni/lib/soapclient.icn | 34 ++-- uni/lib/soapserver.icn | 92 +++++------ uni/lib/sql.icn | 12 +- uni/lib/str_replacer.icn | 10 +- uni/lib/struct.icn | 14 +- uni/lib/thread.icn | 56 +++---- uni/lib/threadh.icn | 36 ++-- uni/lib/time.icn | 294 ++++++++++++++++----------------- uni/lib/timezone.icn | 66 ++++---- uni/lib/union.icn | 4 +- uni/lib/url.icn | 156 ++++++++--------- uni/lib/vgamem.icn | 70 ++++---- uni/lib/webup.icn | 110 ++++++------ 46 files changed, 1233 insertions(+), 1233 deletions(-) diff --git a/uni/lib/_image.icn b/uni/lib/_image.icn index 0e8d0407a..7a6cbcc0b 100644 --- a/uni/lib/_image.icn +++ b/uni/lib/_image.icn @@ -74,12 +74,12 @@ class Image : Component( # Load the image # if \ImageCache then { - / (cache[filename]) := (open(filename,"g", - "canvas=hidden","image="||\filename) | fail) - imwin := cache[filename] - } + / (cache[filename]) := (open(filename,"g", + "canvas=hidden","image="||\filename) | fail) + imwin := cache[filename] + } else if not(imwin := WOpen("image=" || \self.filename, "canvas=hidden")) - then fail + then fail # # Uncomment the following lines if your multiple images are using # more than 256 colors and aren't showing properly on X11 systems. @@ -135,7 +135,7 @@ class Image : Component( else { Zoom(imwin, W,0,0, img_w, img_h, x1 + xoff, y1 + yoff, zoom_w, zoom_h) WClose(imwin) - } + } # # Border if required. diff --git a/uni/lib/basicclasscoding.icn b/uni/lib/basicclasscoding.icn index c64b6d345..7ffd897d8 100644 --- a/uni/lib/basicclasscoding.icn +++ b/uni/lib/basicclasscoding.icn @@ -22,7 +22,7 @@ class BasicClassCoding : ClassCoding() local i, n n := ::integer(d.line_in()) | fail every i := 1 to n do - self[i] := d.decode() | fail + self[i] := d.decode() | fail return end end diff --git a/uni/lib/blockread.icn b/uni/lib/blockread.icn index 055ee3a10..e353ae082 100644 --- a/uni/lib/blockread.icn +++ b/uni/lib/blockread.icn @@ -103,19 +103,19 @@ class BlockRead : Object (f, bSize, buffer) method readBlock(n) /n := bSize if s := ::reads(f, n) then { - i := *s - while (i > 0) & (s[i] ~== "\n") do { - i -:= 1 - } - nbuf := buffer - buffer := s[i+1:0] - return nbuf || s[1+:i] - } + i := *s + while (i > 0) & (s[i] ~== "\n") do { + i -:= 1 + } + nbuf := buffer + buffer := s[i+1:0] + return nbuf || s[1+:i] + } else if *buffer > 0 then { - nbuf := buffer - buffer := "" - return nbuf - } + nbuf := buffer + buffer := "" + return nbuf + } else fail end @@ -173,12 +173,12 @@ initially (fileOrName, blockSize) } else { if ::type(fileOrName) == "string" then { - f := ::open(fileOrName) | - ::stop("BlockRead: Cannot open '",fileOrName,"'!") - } + f := ::open(fileOrName) | + ::stop("BlockRead: Cannot open '",fileOrName,"'!") + } else { - f := fileOrName # Assume it's a file - } + f := fileOrName # Assume it's a file + } } /blockSize := 409600 # default to 1/2 MB reads bSize := blockSize diff --git a/uni/lib/checkbox.icn b/uni/lib/checkbox.icn index 429f00ac5..e5fd6f54f 100644 --- a/uni/lib/checkbox.icn +++ b/uni/lib/checkbox.icn @@ -53,7 +53,7 @@ class CheckBox : Button() DrawRaisedRectangle(cw, self.x + 2 * self.img_w, self.y, self.w - 2 * self.img_w, self.h,1) Uncouple(cw) - } + } self$do_shading(self.cbwin) diff --git a/uni/lib/cltable.icn b/uni/lib/cltable.icn index 0f9aa3174..4b9c6a647 100644 --- a/uni/lib/cltable.icn +++ b/uni/lib/cltable.icn @@ -32,15 +32,15 @@ class ClTable:Object(lookup, names) local l, e l := ::sort(lookup) every e := !l do - e[1] := names[e[1]] + e[1] := names[e[1]] return l end method keys() local e every e := !::sort(names) do { - suspend e[2] - } + suspend e[2] + } end method to_string(depth, seen) @@ -50,11 +50,11 @@ class ClTable:Object(lookup, names) string_buff.add("ClTable<" || get_id() || ">[") pairs := sort(names) every e := !pairs do { - string_buff.add(lang::to_string(e[1], depth - 1, seen)) - string_buff.add("=") - string_buff.add(lang::to_string(e[2], depth - 1, seen)) - string_buff.add(";") - } + string_buff.add(lang::to_string(e[1], depth - 1, seen)) + string_buff.add("=") + string_buff.add(lang::to_string(e[2], depth - 1, seen)) + string_buff.add(";") + } string_buff.drop_last(";") string_buff.add("]") return string_buff.get_string() diff --git a/uni/lib/component.icn b/uni/lib/component.icn index 5cce4352e..9bdc86dfe 100644 --- a/uni/lib/component.icn +++ b/uni/lib/component.icn @@ -427,7 +427,7 @@ class Component : Ticker : MetaComponent( self.parent_Dialog := x self.parent_Component := y if self.cwin := - (Clone!([self.parent_Component$get_cwin_reference()]|||self.attribs)) + (Clone!([self.parent_Component$get_cwin_reference()]|||self.attribs)) then { self.cbwin := (Clone ! ([self.parent_Component$get_cbwin_reference()] ||| @@ -436,7 +436,7 @@ class Component : Ticker : MetaComponent( else { write(&errout, "clone failed, discarding attributes:") every write(&errout, "\t", ! self.attribs) - self.cwin := (Clone ! ([self.parent_Component$get_cwin_reference()])) + self.cwin := (Clone ! ([self.parent_Component$get_cwin_reference()])) if / (self.cwin) then error("window system resource error") self.cbwin :=(Clone ! ([self.parent_Component$get_cbwin_reference()])) if / (self.cbwin) then error("window system resource error #2") diff --git a/uni/lib/compoundedit.icn b/uni/lib/compoundedit.icn index b5b1a2f62..e07bf44b3 100644 --- a/uni/lib/compoundedit.icn +++ b/uni/lib/compoundedit.icn @@ -20,12 +20,12 @@ class CompoundEdit:UndoableEdit(l, closed) method undo() local i every i := *l to 1 by -1 do - l[i].undo() + l[i].undo() end method add_edit(other) if \closed then - fail + fail l[-1].add_edit(other) | ::put(l, other) return end diff --git a/uni/lib/connectable.icn b/uni/lib/connectable.icn index 1069ff303..0e163e6d4 100644 --- a/uni/lib/connectable.icn +++ b/uni/lib/connectable.icn @@ -24,11 +24,11 @@ package util class Connectable(listeners) method genlisteners(typ) case ::type(listeners) of { - "table": suspend !\(listeners[typ]) - "list": every x := !listeners do - if x.type === typ then suspend x - default: if (\listeners).type === typ then return listeners - } + "table": suspend !\(listeners[typ]) + "list": every x := !listeners do + if x.type === typ then suspend x + default: if (\listeners).type === typ then return listeners + } end # @@ -39,28 +39,28 @@ class Connectable(listeners) e := Notification(self, typ, param) every l := genlisteners(\typ|&null) do { - case type(l.obj) of { - "procedure" | "string" | "integer": { - suspend l.obj(self, typ, param) - } - # list invocation here uses substitution rules per future UniLib - # integration. This probably won't work well until that happens. - "list": { - a := ::copy(l.obj) - fcn := ::pop(a) - args := [self, typ, param] - every i := 1 to *a do if a[i] === Arg then a[i] := ::pop(args) - suspend fcn ! a - } - "co-expression": { - args := [self, typ, param] - while suspend args @ l.obj - } - default: { - l.meth(l.obj, e) - } - } - } + case type(l.obj) of { + "procedure" | "string" | "integer": { + suspend l.obj(self, typ, param) + } + # list invocation here uses substitution rules per future UniLib + # integration. This probably won't work well until that happens. + "list": { + a := ::copy(l.obj) + fcn := ::pop(a) + args := [self, typ, param] + every i := 1 to *a do if a[i] === Arg then a[i] := ::pop(args) + suspend fcn ! a + } + "co-expression": { + args := [self, typ, param] + while suspend args @ l.obj + } + default: { + l.meth(l.obj, e) + } + } + } return e end @@ -75,27 +75,27 @@ class Connectable(listeners) # omit duplicate requests every l := genlisteners(typ) do - if (l.obj === obj) & (l.meth === p) then - fail + if (l.obj === obj) & (l.meth === p) then + fail l := Subscription(obj, p, typ) if /listeners then return listeners := l else if ::type(listeners) ~== "list" & ::type(listeners) ~== "table" then - listeners := [listeners] # promote to list and continue + listeners := [listeners] # promote to list and continue if ::type(listeners) == "list" then { - if (!listeners).type ~=== typ then { - T := ::table() - every x := !listeners do { - /T[x.type] := [] - ::put(T[x.type], x) - } - listeners := T # promote to table and continue - } - else { ::put(listeners, l); return l } - } + if (!listeners).type ~=== typ then { + T := ::table() + every x := !listeners do { + /T[x.type] := [] + ::put(T[x.type], x) + } + listeners := T # promote to table and continue + } + else { ::put(listeners, l); return l } + } /listeners[typ] := [] ::put(listeners[typ], l) @@ -116,14 +116,14 @@ class Connectable(listeners) local k, t, l if ::type(listeners) == "table" then { - every k := ::key(listeners) do - listeners[k] := disconnect_fromlist(listeners[k], obj) - } + every k := ::key(listeners) do + listeners[k] := disconnect_fromlist(listeners[k], obj) + } else if ::type(listeners) == "list" then - listeners := disconnect_fromlist(listeners, obj) + listeners := disconnect_fromlist(listeners, obj) else if ::type(listeners) == "Subscription" then - if listeners.obj === obj then listeners := &null + if listeners.obj === obj then listeners := &null end @@ -138,13 +138,13 @@ class Connectable(listeners) t := [] if ::type(listeners) == "list" then { - every ::put(t, l ~=== !listeners) - listeners := t - } + every ::put(t, l ~=== !listeners) + listeners := t + } else if ::type(listeners) == "table" then { - every ::put(t, l ~=== !listeners[k]) - listeners[k] := t - } + every ::put(t, l ~=== !listeners[k]) + listeners[k] := t + } end initially diff --git a/uni/lib/contentdisposition.icn b/uni/lib/contentdisposition.icn index 04ca4b76d..48485f4c2 100644 --- a/uni/lib/contentdisposition.icn +++ b/uni/lib/contentdisposition.icn @@ -64,7 +64,7 @@ class ContentDisposition:Error(type, parameters) method rfc1521_parameters() local e, s := "" every e := !parameters.sort() do - s ||:= " ; " || e[1] || "=" || e[2] + s ||:= " ; " || e[1] || "=" || e[2] return s end @@ -75,6 +75,6 @@ class ContentDisposition:Error(type, parameters) initially(a[]) parameters := ClTable() if (*a = 1) & (::type(a[1]) == "string") then { - parse(a[1]) | fail - } + parse(a[1]) | fail + } end diff --git a/uni/lib/contenttype.icn b/uni/lib/contenttype.icn index 6b3a0bd69..ce2554f55 100644 --- a/uni/lib/contenttype.icn +++ b/uni/lib/contenttype.icn @@ -28,20 +28,20 @@ class ContentType:ContentDisposition(subtype) method parse(s) local p := mail::RFC822Parser() return p.parse_content_type(s, self) | error(p) - end + end method to_rfc1521() return type || "/" || subtype || rfc1521_parameters() end - # can inherit initially() from superclass once initially-w-parameters + # can inherit initially() from superclass once initially-w-parameters # inheritance bug is fixed, i.e. not yet. initially(a[]) parameters := ClTable() if (*a = 1) & (::type(a[1]) == "string") then { - parse(a[1]) | fail - } + parse(a[1]) | fail + } end diff --git a/uni/lib/database.icn b/uni/lib/database.icn index 5597af09b..a0e3711ef 100644 --- a/uni/lib/database.icn +++ b/uni/lib/database.icn @@ -29,7 +29,7 @@ class Database : Object (dsn, db_table, db, dbu, blockDepth) # <[fails if unable to open database]> #

method open(user, # Valid database user id - password) # Password for that user. + password) # Password for that user. static real_open initial real_open := ::proc("open") return \accessDb(real_open(dsn,"o",db_table,user,password)) @@ -142,13 +142,13 @@ class Database : Object (dsn, db_table, db, dbu, blockDepth) method update(rec, # table of fields (key is field name, # entry is new field value) to update # (Can also be a record) - whereClause # SQL where clause (w/o the 'WHERE') + whereClause # SQL where clause (w/o the 'WHERE') # that identifies rows to modify ) s := "UPDATE " || db_table || " SET " every k := ::key(rec) do { - s ||:= k ||"="||"'"||dbu.escape(rec[k])||"'," - } + s ||:= k ||"="||"'"||dbu.escape(rec[k])||"'," + } s := s[1:-1] # delete trailing comma? s ||:= " WHERE "||\whereClause return sql(s) @@ -185,8 +185,8 @@ class Database : Object (dsn, db_table, db, dbu, blockDepth) #

method startBlock() if blockDepth = 0 then { - sql("BEGIN") - } + sql("BEGIN") + } blockDepth +:= 1 end @@ -197,11 +197,11 @@ class Database : Object (dsn, db_table, db, dbu, blockDepth) #

method endBlock() if blockDepth > 0 then { - blockDepth -:= 1 - if blockDepth = 0 then { - sql("COMMIT") - } - } + blockDepth -:= 1 + if blockDepth = 0 then { + sql("COMMIT") + } + } end #

@@ -209,13 +209,13 @@ class Database : Object (dsn, db_table, db, dbu, blockDepth) #

method abortBlock() if blockDepth > 0 then { - sql("ROLLBACK") - } + sql("ROLLBACK") + } blockDepth := 0 end initially(DSN, # Data store name (odbc) - DB_TABLE) # Table to access at that DSN + DB_TABLE) # Table to access at that DSN dsn := DSN db_table := DB_TABLE dbu := DButils() diff --git a/uni/lib/dispatcher.icn b/uni/lib/dispatcher.icn index 7d8235dd1..0d3cc4ae9 100644 --- a/uni/lib/dispatcher.icn +++ b/uni/lib/dispatcher.icn @@ -149,15 +149,15 @@ class Dispatcher( # # Discard the event and beep in the window. # A close on a blocked window is a bad situation, - # probably the application should terminate in response - # to a process_event(), but if not, + # probably the application should terminate in response + # to a process_event(), but if not, # use the hidden offscreen window until it is unblocked. # e := Event(d.win) - if integer(e) = -11 then { - d.win := d.buffer_win - d$process_event(e) - } + if integer(e) = -11 then { + d.win := d.buffer_win + d$process_event(e) + } else if not(integer(e) = (&lrelease | &rrelease | &mrelease | &ldrag | &rdrag | &mdrag)) then Alert(d.win) } diff --git a/uni/lib/doptions.icn b/uni/lib/doptions.icn index 0e8730f92..d942093ec 100644 --- a/uni/lib/doptions.icn +++ b/uni/lib/doptions.icn @@ -5,10 +5,10 @@ # # If you have a large program spread over a number of separately-compiled # packages, classes, etc., using options that change frequently, you don't -# want to specify all these options in main(). +# want to specify all these options in main(). # This package allows decentralized processing of options (arguments to # the main program), according to specification strings that can be defined -# wherever the particular options are used. +# wherever the particular options are used. # # Drawback: checking for unrecognized options is more cumbersome in a # decentralized setting. @@ -29,13 +29,13 @@ # B() # doptions::check() # end -# +# # procedure A() # local opts, s # opts := doptions::get("-a:") # s := opts["a"] # end -# +# # procedure B() # local opts, s # opts := doptions::get("-b:") @@ -61,7 +61,7 @@ procedure get(opt_string) end # Catches unrecognized options. To be called by somebody, possibly main(), -# after it is known that everyone has finished reading his/her options. +# after it is known that everyone has finished reading his/her options. procedure check() \initialized | stop("doptions::check: init() must be called first!") return options(main_args, all_opt_string, , 1) @@ -70,7 +70,7 @@ end # This is the standard options() from the Icon program library, modified by # splitting error handling into two: -# the procedure "errproc" that gets called on incorrect option specifications, +# the procedure "errproc" that gets called on incorrect option specifications, # and a flag "unrec", which, when set, checks for unrecognized options. procedure options(arg,optstring,errproc,unrec) @@ -91,7 +91,7 @@ procedure options(arg,optstring,errproc,unrec) while optname := move(1) do { if optname == " " then next if optname == "-" then - optname := tab(many(optcs)) | move(1) | break + optname := tab(many(optcs)) | move(1) | break opttype := tab(any('!:+.')) | "!" opttable[optname] := opttype } @@ -103,42 +103,42 @@ procedure options(arg,optstring,errproc,unrec) if /x then ignore := &null # if end of args from file, stop ignoring else x ? { if ="-" & not pos(0) & /ignore then { - if ="-" & pos(0) then ignore := 1 # ignore following args if -- - else { - tab(0) ? until pos(0) do { - if opttype := \opttable[optname := ((pos(1),tab(0)) | move(1))] then { - option[optname] := - if any(':+.',opttype) then { - p := "" ~== tab(0) | ::get(arg) | - return errproc("No parameter following -" || optname) - case opttype of { - ":": p - "+": integer(p) | - return errproc("-"||optname||" needs numeric parameter") - ".": real(p) | - return errproc("-"||optname||" needs numeric parameter") - } - } - else 1 - } - else { - if \unrec then stop("Unrecognized option: -" || optname) - else break - } - } - } + if ="-" & pos(0) then ignore := 1 # ignore following args if -- + else { + tab(0) ? until pos(0) do { + if opttype := \opttable[optname := ((pos(1),tab(0)) | move(1))] then { + option[optname] := + if any(':+.',opttype) then { + p := "" ~== tab(0) | ::get(arg) | + return errproc("No parameter following -" || optname) + case opttype of { + ":": p + "+": integer(p) | + return errproc("-"||optname||" needs numeric parameter") + ".": real(p) | + return errproc("-"||optname||" needs numeric parameter") + } + } + else 1 + } + else { + if \unrec then stop("Unrecognized option: -" || optname) + else break + } + } + } } # # If the argument begins with the character "@", fetch option # words from lines of a text file. # else if ="@" & not pos(0) & /ignore then { - f := open(fn := tab(0)) | return errproc("Can't open " || fn) - fileArg := [] - while put(fileArg,read(f)) - close(f) - push(arg) # push null to signal end of args from file - while push(arg,pull(fileArg)) + f := open(fn := tab(0)) | return errproc("Can't open " || fn) + fileArg := [] + while put(fileArg,read(f)) + close(f) + push(arg) # push null to signal end of args from file + while push(arg,pull(fileArg)) } else put(fList,x) } diff --git a/uni/lib/exception.icn b/uni/lib/exception.icn index a45f70c1e..e28f615a5 100644 --- a/uni/lib/exception.icn +++ b/uni/lib/exception.icn @@ -65,15 +65,15 @@ class Try : Object (sources, exceptions, lastException) ::push(exceptions, &null) # placeholder # Consider making this a generator! if result := (@L[1])\1 then { - ::pop(sources) - lastException := ::pop(exceptions) | &null - return result - } + ::pop(sources) + lastException := ::pop(exceptions) | &null + return result + } else { - ::pop(sources) - lastException := ::pop(exceptions) | &null - fail - } + ::pop(sources) + lastException := ::pop(exceptions) | &null + fail + } end #

@@ -83,19 +83,19 @@ class Try : Object (sources, exceptions, lastException) method throw(exception) # Exception to throw. while *sources > 0 do { - # Save the exception for checking with catch() later. - exceptions[1] := exception - exception @ sources[1] - # If we get back here, nothing caught exception, propagate up - # (the sources stack has been popped) - } + # Save the exception for checking with catch() later. + exceptions[1] := exception + exception @ sources[1] + # If we get back here, nothing caught exception, propagate up + # (the sources stack has been popped) + } # Quit if exception isn't caught at all... # If the exception is thrown inside a Try() that doesn't # catch it, this code is never reached. I.e. uncaught # exceptions are ignored if any are tried to be caught. ::stop("Exception thrown outside of Try call: ", - exception.getMessage(),":\n",exception.getLocation()) + exception.getMessage(),":\n",exception.getLocation()) end @@ -145,7 +145,7 @@ class Try : Object (sources, exceptions, lastException) initially () sources := [] # Stack of 'try' clauses exceptions := [] # Stack of thrown exceptions (probably always - # <= size 1) - this needs more thought! + # <= size 1) - this needs more thought! Try := create |self # Convert to a singleton object end diff --git a/uni/lib/fcn_util.icn b/uni/lib/fcn_util.icn index 8fa4d3680..68d1acd91 100644 --- a/uni/lib/fcn_util.icn +++ b/uni/lib/fcn_util.icn @@ -130,8 +130,8 @@ class Closure : Object (fcn) flist := ::copy(flist) /args := ::list() every i := 2 to *flist do - if flist[i] === Arg then - flist[i] := ::pop(args) | &null + if flist[i] === Arg then + flist[i] := ::pop(args) | &null suspend invokeFcn ! (flist ||| args) end @@ -141,7 +141,7 @@ class Closure : Object (fcn) # of invocation using arguments to the calls() method. #

initially (f, # function that closure is built around - args[] # remaining parameters are arguments supplied + args[] # remaining parameters are arguments supplied # as part of closure ) /args := [] @@ -217,29 +217,29 @@ procedure invokeFcn(fcn, args[]) /args := ::list() case ::type(fcn) of { "procedure" | "integer" | "string" : { - suspend fcn!args - } + suspend fcn!args + } "list" : { - fcn := ::copy(fcn) + fcn := ::copy(fcn) f := ::pull(fcn) - every i := 1 to *fcn do { - if fcn[i] === Arg then { - fcn[i] := ::pop(args) | &null - } - } - suspend f!(fcn ||| args) - } + every i := 1 to *fcn do { + if fcn[i] === Arg then { + fcn[i] := ::pop(args) | &null + } + } + suspend f!(fcn ||| args) + } "co-expression" : { - while suspend args@fcn - } + while suspend args@fcn + } default : { - if isClass(fcn) & fcn.instanceOf("lang::Closure") then { - suspend fcn.call ! args - } - else { - suspend fcn!args - } - } + if isClass(fcn) & fcn.instanceOf("lang::Closure") then { + suspend fcn.call ! args + } + else { + suspend fcn!args + } + } } end diff --git a/uni/lib/file_dlg.icn b/uni/lib/file_dlg.icn index e7568ff98..da6477bf5 100644 --- a/uni/lib/file_dlg.icn +++ b/uni/lib/file_dlg.icn @@ -1,25 +1,25 @@ ############################################################################ # -# File: file_dlg.icn +# File: file_dlg.icn # -# Subject: +# Subject: # -# Author: Robert Parlett +# Author: Robert Parlett # -# Date: October, 1998 +# Date: October, 1998 # ############################################################################ # # This file is in the public domain. # ############################################################################ -# +# # File dialog box -# -# +# +# ############################################################################ # -# Links: +# Links: # ############################################################################ @@ -36,13 +36,13 @@ $endif class FileDialog : _Dialog( init_dir, # Initial directory name init_file, # Initial file name - res, # Resulting file path + res, # Resulting file path dir, # TextField directory file, # TextField filename - dlist, # TextList of directories - flist, # TextList of files - okay, # - cancel, # + dlist, # TextList of directories + flist, # TextList of files + okay, # + cancel, # extra_attribs # Custom attributes ) @@ -83,7 +83,7 @@ class FileDialog : _Dialog( # # Set the initial file/directory from a whole path. - # + # method set_path(s) self.init_dir := directory_name(s) self.init_file := file_name(s) @@ -111,7 +111,7 @@ class FileDialog : _Dialog( method dialog_event(ev) case ev$get_component() of { cancel : { - if ev$get_code() > 0 then + if ev$get_code() > 0 then self$dispose() } @@ -142,7 +142,7 @@ class FileDialog : _Dialog( # # Go to parent directory (unless at root directory) # - if value == (".." || PATHCHAR) then { + if value == (".." || PATHCHAR) then { if s ~== PATHCHAR then { s[-1] := "" while s[-1] ~== PATHCHAR do s[-1] := "" @@ -207,7 +207,7 @@ class FileDialog : _Dialog( method init_dialog() self$set_focus(file) end - + method component_setup() # # Defaults if none set by caller. @@ -233,7 +233,7 @@ class FileDialog : _Dialog( l$set_pos(50, 50) l$set_align("l", "c") self$add(l) - + dir := TextField() dir$set_pos(150, 50) dir$set_size("100%-200") @@ -254,7 +254,7 @@ class FileDialog : _Dialog( file$set_contents(init_file) self$add(file) - l1 := [] + l1 := [] l2 := [] get_directory_list(init_dir, l1, l2) @@ -302,7 +302,7 @@ $ifdef _MS_WINDOWS_NT $else if (*s > 1) & (s[-1] == PATHCHAR) then s[-1] := "" $endif - + p := open(s) | { write(&errout, "get_directory_list: can't open ", image(s)) fail @@ -310,8 +310,8 @@ $endif if not (s[-1] == PATHCHAR) then s ||:= PATHCHAR while s2 := read(p) do { sr := stat(s||s2) | { - write(&errout, "get_directory_list: can't stat ", image(s2)) - fail + write(&errout, "get_directory_list: can't stat ", image(s2)) + fail } if sr.mode[1] == "d" then put(dir_list, s2 || PATHCHAR) diff --git a/uni/lib/genserve.icn b/uni/lib/genserve.icn index f8df4a5fb..3b943b090 100644 --- a/uni/lib/genserve.icn +++ b/uni/lib/genserve.icn @@ -14,22 +14,22 @@ $define DEFAULT_PORT 8080 $include "posix.icn" class SocketDriver( - socket, - user, # Associated user object, or &null if none + socket, + user, # Associated user object, or &null if none - dtype, # one of "listen", "admin", or "user" + dtype, # one of "listen", "admin", or "user" - pending_output,# string containing generated output not yet sent - # across the socket barrier. + pending_output,# string containing generated output not yet sent + # across the socket barrier. - pending_input, # unhandled input (typically from incomplete lines). + pending_input, # unhandled input (typically from incomplete lines). - partition, # A string that indicates a logical break in the - # inputs. "\n" for example. This could be extended - # to be a list of strings. + partition, # A string that indicates a logical break in the + # inputs. "\n" for example. This could be extended + # to be a list of strings. - Error # Indicates a socket failure if set - ) + Error # Indicates a socket failure if set + ) ## # returns the pending input on socket. If partition is set, the input @@ -39,39 +39,39 @@ class SocketDriver( method read_socket() local buffer, buffer2 if buffer2 := pending_input || ready( socket ) then { - pending_input := "" - if /partition then # no partitions, return everything - return buffer2 - - buffer2 ? { - while buffer := tab(find(partition)) do { - move(*partition) - pending_input := &subject[&pos:0] - suspend buffer - } - if *(buffer := tab(0)) > 0 then - pending_input := buffer - } # buffer2 ? ... - } + pending_input := "" + if /partition then # no partitions, return everything + return buffer2 + + buffer2 ? { + while buffer := tab(find(partition)) do { + move(*partition) + pending_input := &subject[&pos:0] + suspend buffer + } + if *(buffer := tab(0)) > 0 then + pending_input := buffer + } # buffer2 ? ... + } else - Error := "Failure in reading input from socket: " || image(socket) + Error := "Failure in reading input from socket: " || image(socket) end - + method write_socket(s) pending_output ||:= s #writes(socket, s) end - - # + + # # flushes any pending output on the socket # method flush() if *(\pending_output) > 0 then { - writes(socket, pending_output) - pending_output := "" - } + writes(socket, pending_output) + pending_output := "" + } end - + initially /pending_input := "" /pending_output := "" @@ -86,8 +86,8 @@ class LogHandler() local msg, s msg:="" every s := !L do - msg ||:= s - + msg ||:= s + write(&clock," ",msg) end end @@ -96,16 +96,16 @@ end # A basic server class, ideas from cved # class BasicServer( - port, # one port for now. Some future servers may need to - # listen to several ports. + port, # one port for now. Some future servers may need to + # listen to several ports. - server_name, # text name of the server. Default: Unicon Server + server_name, # text name of the server. Default: Unicon Server - Tsocket_drivers, # socket to SocketDriver objects - socket_list, - logger, # Logger object - fileHandler # fileTransfer object ? to be added - ) + Tsocket_drivers, # socket to SocketDriver objects + socket_list, + logger, # Logger object + fileHandler # fileTransfer object ? to be added + ) ## # Starts listening on a specific port for TCP requests @@ -117,15 +117,15 @@ class BasicServer( /p := port if not(listen_sock := server_socket(p)) then { logger.logit("open_listener_TCP(:",image(port), - "): starting server failed because ", sys_errstr(&errno)) + "): starting server failed because ", sys_errstr(&errno)) shutdown() } - logger.logit("open_listener_TCP():", server_name, - " started on port ", port) + logger.logit("open_listener_TCP():", server_name, + " started on port ", port) add_socket(listen_sock, &null, "listen") end - + # # add sock to the list of open connections # @@ -133,7 +133,7 @@ class BasicServer( Tsocket_drivers[sock] := SocketDriver(sock, user, typ) put(socket_list, sock) end - + ## # close connection to sock and remove it with its driver #@param sock socket to be removed @@ -141,12 +141,12 @@ class BasicServer( local i Tsocket_drivers[sock].pending_output := "" delete( Tsocket_drivers, sock ) - + every i := 1 to *socket_list do { - if socket_list[i] === sock then { - delete(socket_list, i) - } - } + if socket_list[i] === sock then { + delete(socket_list, i) + } + } close( sock ) end @@ -157,7 +157,7 @@ class BasicServer( method server_socket(p) return open(":" || p, "nl") end - + method process_input(driver, buffer) stop("Error: Server should implement method process_input(driver, buffer)") end @@ -169,62 +169,62 @@ class BasicServer( local i, sock, L, buffer, driver, listen_sock repeat { - L := select( socket_list, SERVER_TIMEOUT*1000) - - every sock := !L do { - driver := Tsocket_drivers[sock] - - if /driver then { - logger.logit("Run(): This should not happen! _ - What is the best way to handle this? _ - Driver is null; do not know socket:" || image(sock)) - next # fail? - } - - case driver.dtype of { - "listen": { - - # If they can't log in, stop listening to them. - # login() would have closed the socket already - if not login(driver) then - remove_socket(sock) - - # create a net listener socket to replace the last one - # note that the last one gets connected to a user in the - # lower level code regardless of whether the login works, - # and is thus not usable for listening for any new users. - # This is a feature of the unicon networking design, and - # probably a good one. - - if listen_sock := server_socket(port) then - add_socket(listen_sock, &null, "listen") - else { - logger.logit("Run(): can't open a new listener!") - # need to do more here - } - } - - # Read from connected, "live" sockets - "admin" | "user" : { - every buffer := driver.read_socket() do { - process_input(driver, buffer) - } - - if \driver.Error then { - logger.logit ("Run() :", driver.Error) - remove_socket(sock) - } - } - - default: { - write("unknown driver.dtype ", image(driver.dtype)) - } + L := select( socket_list, SERVER_TIMEOUT*1000) + + every sock := !L do { + driver := Tsocket_drivers[sock] + + if /driver then { + logger.logit("Run(): This should not happen! _ + What is the best way to handle this? _ + Driver is null; do not know socket:" || image(sock)) + next # fail? + } + + case driver.dtype of { + "listen": { + + # If they can't log in, stop listening to them. + # login() would have closed the socket already + if not login(driver) then + remove_socket(sock) + + # create a net listener socket to replace the last one + # note that the last one gets connected to a user in the + # lower level code regardless of whether the login works, + # and is thus not usable for listening for any new users. + # This is a feature of the unicon networking design, and + # probably a good one. + + if listen_sock := server_socket(port) then + add_socket(listen_sock, &null, "listen") + else { + logger.logit("Run(): can't open a new listener!") + # need to do more here + } + } + + # Read from connected, "live" sockets + "admin" | "user" : { + every buffer := driver.read_socket() do { + process_input(driver, buffer) + } + + if \driver.Error then { + logger.logit ("Run() :", driver.Error) + remove_socket(sock) + } + } + + default: { + write("unknown driver.dtype ", image(driver.dtype)) + } # end default - } # end case - } # end every sock := !L + } # end case + } # end every sock := !L - every driver := !Tsocket_drivers do - driver.flush() + every driver := !Tsocket_drivers do + driver.flush() } # end repeat end @@ -238,7 +238,7 @@ class BasicServer( driver.dtype := "user" return end - + # # shutdown: gracefully shuts down the server. # @@ -246,16 +246,16 @@ class BasicServer( local sock # remove sockets every sock := key(Tsocket_drivers) do - remove_socket( sock ) + remove_socket( sock ) logger.logit("shutdown(): ", server_name, " ", server_version()) exit(0) end - + method server_version() return "0.1" end - + initially /server_name := "Unicon Server" /port := DEFAULT_PORT @@ -277,9 +277,9 @@ $ifdef MAIN procedure main() trap("SIGINT", SIGINT_handler) - + server := BasicServer(9000, "Generic Server") - + write("opening TCP connection...") server.open_listener_TCP() diff --git a/uni/lib/gui.icn b/uni/lib/gui.icn index 96db6b14a..108f1b386 100644 --- a/uni/lib/gui.icn +++ b/uni/lib/gui.icn @@ -1,12 +1,12 @@ ############################################################################ # -# File: gui.icn +# File: gui.icn # -# Subject: Set of classes for GUI objects in Unicon +# Subject: Set of classes for GUI objects in Unicon # -# Authors: Robert Parlett, Clint Jeffery, Susie Jeffery +# Authors: Robert Parlett, Clint Jeffery, Susie Jeffery # -# Date: 16 January, 2001 +# Date: 16 January, 2001 # ############################################################################ # @@ -375,7 +375,7 @@ class _Dialog : Container( end method process_event(e) - local res, found, c, wrap, nw, nh, t + local res, found, c, wrap, nw, nh, t if integer(e) = -11 then { dispose(1) } @@ -398,7 +398,7 @@ class _Dialog : Container( while Pending(self.win)[1] === e do { e := Event(self.win) # delay(50) - } + } nw := &x nh := &y @@ -424,7 +424,7 @@ class _Dialog : Container( if e === (&ldrag | &rdrag | &mdrag) then { while *Pending(self.win) > 0 & Pending(self.win)[1] === e do { e := Event(self.win) - } + } } every E := (\self.unique_flag)$handle_event(e) do { @@ -544,16 +544,16 @@ class MetaComponent() (val := tab(0)) } if find(",", val) then { - vals := [] - val ? { - while put(vals, tab(find(","))) do move(1) - put(vals, tab(0)) - } - self.__m["set_" || attr] ! (push(vals, self)) - } - else - self.__m["set_" || attr] (self, val) - } + vals := [] + val ? { + while put(vals, tab(find(","))) do move(1) + put(vals, tab(0)) + } + self.__m["set_" || attr] ! (push(vals, self)) + } + else + self.__m["set_" || attr] (self, val) + } end end @@ -758,13 +758,13 @@ end $include "_panel.icn" # a panel on which a background attribute should work -# The parameter "buffer_flag" just tells it whether to draw directly into the +# The parameter "buffer_flag" just tells it whether to draw directly into the # visible window, or to use its non-visible buffer window instead (this is # used for double-buffering). class FillPanel : Panel() method display(buffer_flag) - EraseRectangle(if /buffer_flag then self.cwin else self.cbwin, + EraseRectangle(if /buffer_flag then self.cwin else self.cbwin, self.x, self.y, self.w, self.h) self.Panel.display(buffer_flag) end @@ -800,7 +800,7 @@ procedure CacheImage(win,x,y,w,h,filename) /cache := table() /zoomed := table() / (cache[filename]) := open(filename,"g", - "canvas=hidden","image="||filename) | + "canvas=hidden","image="||filename) | stop("can't open ", image(filename)) wc := cache[filename] @@ -813,7 +813,7 @@ procedure CacheImage(win,x,y,w,h,filename) if / (zoomed[filename][w||","||h]) := open(filename,"g","size="||w||","||h, "canvas=hidden") then { Zoom(wc, zoomed[filename][w||","||h], - 0,0,WAttrib(wc,"width"),WAttrib(wc,"height"),0,0,w,h) + 0,0,WAttrib(wc,"width"),WAttrib(wc,"height"),0,0,w,h) } zc := zoomed[filename][w||","||h] CopyArea(zc, win, 0, 0, w, h, x, y) diff --git a/uni/lib/guiconst.icn b/uni/lib/guiconst.icn index be1856c8b..5b24e8e53 100644 --- a/uni/lib/guiconst.icn +++ b/uni/lib/guiconst.icn @@ -1,25 +1,25 @@ ############################################################################ # -# File: guiconst.icn +# File: guiconst.icn # -# Subject: Constants for use with gui.icn +# Subject: Constants for use with gui.icn # -# Author: Robert Parlett +# Author: Robert Parlett # -# Date: +# Date: # ############################################################################ # # This file is in the public domain. # ############################################################################ -# -# -# -# +# +# +# +# ############################################################################ # -# Links: +# Links: # ############################################################################ diff --git a/uni/lib/heap.icn b/uni/lib/heap.icn index f49edf425..18f4ad0f8 100644 --- a/uni/lib/heap.icn +++ b/uni/lib/heap.icn @@ -73,14 +73,14 @@ class Heap : Object (L, f, p) initial call := invokeFcn if *L > 0 then { L[up:=1] :=: L[-1] - result := ::pull(L) - while (down := 2*up) <= *L do { - if call(p,call(f,L[down+1]), call(f,L[down])) then down +:= 1 - if call(p,call(f,L[down]),call(f,L[up])) then L[up]:=:L[down] - up := down - } - return result - } + result := ::pull(L) + while (down := 2*up) <= *L do { + if call(p,call(f,L[down+1]), call(f,L[down])) then down +:= 1 + if call(p,call(f,L[down]),call(f,L[up])) then L[up]:=:L[down] + up := down + } + return result + } end #

@@ -95,9 +95,9 @@ class Heap : Object (L, f, p) ::put(L,a) i := *L while call(p,call(f,L[i]), call(f,L[i/2])) do { - L[i] :=: L[i/2] - i /:= 2 - } + L[i] :=: L[i/2] + i /:= 2 + } return a end diff --git a/uni/lib/iconbutton.icn b/uni/lib/iconbutton.icn index 89e71bf4d..bfca7921c 100644 --- a/uni/lib/iconbutton.icn +++ b/uni/lib/iconbutton.icn @@ -52,9 +52,9 @@ class IconButton : Button() } else { if \self.draw_border_flag then { if /self.is_checked_flag then - DrawRaisedRectangle(self.cbwin,self.x, self.y, self.w, self.h,2) + DrawRaisedRectangle(self.cbwin,self.x, self.y, self.w, self.h,2) else - DrawSunkenRectangle(self.cbwin,self.x, self.y, self.w, self.h,2) + DrawSunkenRectangle(self.cbwin,self.x, self.y, self.w, self.h,2) } } diff --git a/uni/lib/json.icn b/uni/lib/json.icn index 17b0b55ed..3507014d2 100644 --- a/uni/lib/json.icn +++ b/uni/lib/json.icn @@ -13,12 +13,12 @@ package json -class ErrorHandler(filename, - lineno, +class ErrorHandler(filename, + lineno, error, errout, tag, - strict # Flag to enforce strict JSON if not null + strict # Flag to enforce strict JSON if not null ) method init(filename) self.filename := filename @@ -33,7 +33,7 @@ class ErrorHandler(filename, end method constr_msg(s) - if \filename then + if \filename then return tag || " " || filename || ":" || lineno || ": " || s else return tag || " " || s @@ -58,7 +58,7 @@ class ErrorHandler(filename, # # Write out (error), if it exists, to (errout) # - method get_err() + method get_err() if \error then { write(errout, error) } @@ -94,7 +94,7 @@ $endif # # For scanner speed testing # -$ifdef SCAN +$ifdef SCAN procedure main(argv) local input if *argv=0 then { @@ -122,7 +122,7 @@ $endif # If the conversion fails, jtou() attempts to use s as a # filename. If it fails, then the function fails. # -# This procedure is a generator. It will return the +# This procedure is a generator. It will return the # corresponding unicon objects, one-by-one, until the # conversion is complete. # @@ -142,9 +142,9 @@ procedure jtou(s,strict,mode,error) tok_gen := create json_scanner(s,jerror) if u := json_parser(tok_gen,jerror) then { suspend u - while u := json_parser(tok_gen,jerror) do suspend u - fail - } + while u := json_parser(tok_gen,jerror) do suspend u + fail + } # string conversion failed, run as file else { if not (file := open(s)) then { @@ -168,8 +168,8 @@ procedure jtou(s,strict,mode,error) jerror.init(s) } # string mode - "s" : j := s - default: return jerror.write_err("Invalid mode "||image(mode)) + "s" : j := s + default: return jerror.write_err("Invalid mode "||image(mode)) } } # parse @@ -225,7 +225,7 @@ end # # Given a Unicon structure, produce a JSON equivalent if possible. # This function add meta data to the output to aid in reconstructing -# the original Unicon structure. +# the original Unicon structure. # <[param x - a Unicon structure]> # <[param strict - Flag for specifing strict JSON syntax (non-null)]> # <[param error - file for error messages (defaults to &errout)]> @@ -234,7 +234,7 @@ end procedure utoj(x,strict,error) local j; jerror := ErrorHandler(error,strict) - + if j := _utoj(x,jerror) then return j @@ -277,14 +277,14 @@ procedure _utoj(u,jerror, raw) "string": { return if u == "__true__" then "true" else if u == "__false__" then "false" - else jsonify_string(u,jerror) + else jsonify_string(u,jerror) } "integer" | "real": return image(u) "list": { s := "[" if *u > 0 then s ||:= _utoj(u[1],jerror, raw) every i := 2 to *u do { - s ||:= ("," || _utoj(u[i],jerror, raw)) | fail + s ||:= ("," || _utoj(u[i],jerror, raw)) | fail } s ||:= "]" return s @@ -297,7 +297,7 @@ procedure _utoj(u,jerror, raw) i := 1 every x := !u do { if i>1 then s ||:= "," - s ||:= _utoj(x,jerror, raw) | fail + s ||:= _utoj(x,jerror, raw) | fail i +:= 1 } if \raw then @@ -318,11 +318,11 @@ procedure _utoj(u,jerror, raw) else s := "{\"__unitable__\":1" every k := key(u) do { - if s[-1] ~== "{" then s ||:= "," - if type(k) == "string" then + if s[-1] ~== "{" then s ||:= "," + if type(k) == "string" then s ||:= jsonify_string(k,jerror, raw)||":"|| _utoj(u[k],jerror, raw) | fail else { - if \(jerror.strict) then + if \(jerror.strict) then s ||:= "\""||image(k)||"\":"||_utoj(u[k],jerror, raw) | fail else s ||:= _utoj(k,jerror)||":"||_utoj(u[k],jerror, raw) | fail @@ -376,7 +376,7 @@ procedure _utoj(u,jerror, raw) end # -# Procedure for converting Unicon escapes and escape sequences to valid +# Procedure for converting Unicon escapes and escape sequences to valid # JSON escape sequences. # procedure jsonify_string(s,jerror) @@ -404,7 +404,7 @@ procedure jsonify_string(s,jerror) "\" contains an illegal double quote for JSON strings") # Handle escape sequences if c == "\\" then { - case (c := move(1)) | + case (c := move(1)) | return jerror.set_err("Incomplete escape sequence") of { # JSON escapes "\\": ns ||:= "\\\\" @@ -436,7 +436,7 @@ procedure jsonify_string(s,jerror) } ns ||:= "\\u00"||tmp } - !oct: { # octal + !oct: { # octal # Taken from octcode() in escape.icn tmp := c || tab(many(oct)) | "" if (i := *tmp) > 3 then { # back off if too large @@ -466,7 +466,7 @@ end # Given an octal string, returns a hexadecimal string. Uses Unicon octal # specifications # -procedure _octtohex(s) +procedure _octtohex(s) local val := 0, len := *s, i := len while i > 0 do { val +:= integer(s[i]) * 8^(len-i) @@ -479,13 +479,13 @@ end # Given an integer value, return a hexidecimal string # procedure _dectohex(val) - local ns := "", rem + local ns := "", rem while val > 0 do { rem := val % 16 val := integer(val/16) - if rem < 10 then ns := string(rem) || ns + if rem < 10 then ns := string(rem) || ns else case rem of { 10: ns := "A" || ns 11: ns := "B" || ns @@ -495,7 +495,7 @@ procedure _dectohex(val) 15: ns := "F" || ns } } - return ns + return ns end ##################### @@ -503,13 +503,13 @@ end ##################### # -# A string-scanning generator - takes a JSON-formatted string +# A string-scanning generator - takes a JSON-formatted string # and returns single JSON tokens until scanning is complete # procedure json_scanner(s,jerror) local token local ws, operator, number - local end_pos := *s + 1 + local end_pos := *s + 1 ws := ' \t' operator := '{}[]:,' @@ -549,8 +549,8 @@ end # procedure scan_true(jerror) if move(3) == "rue" then return "true" - else - return jerror.set_err("Expected JSON true: " || + else + return jerror.set_err("Expected JSON true: " || "t"||tab(upto(' \t\n{}[]:,')\1)) end @@ -559,8 +559,8 @@ end # procedure scan_false(jerror) if move(4) == "alse" then return "false" - else - return jerror.set_err("Expected JSON false: " || + else + return jerror.set_err("Expected JSON false: " || "f"||tab(upto(' \t\n{}[]:,')\1)) end @@ -568,9 +568,9 @@ end # String scanning helper function to retrieve JSON value 'null' # procedure scan_null(jerror) - if move(3) == "ull" then return "null" - else - return jerror.set_err("Expected JSON null: " || + if move(3) == "ull" then return "null" + else + return jerror.set_err("Expected JSON null: " || "n"||tab(upto(' \t\n{}[]:,')\1)) end @@ -585,7 +585,7 @@ procedure scan_ctrl_char(jerror) # # This code is modified from escape() from IPL file escape.icn # - case (c := move(1)) | + case (c := move(1)) | return jerror.set_err("Incomplete JSON escape sequence") of { # JSON escapes "b": return "\b" @@ -597,15 +597,15 @@ procedure scan_ctrl_char(jerror) "/": return "/" "\"": return "\"" "u": { - # + # # Code taken from hexcode() in escape.icn and modified to handle # unicode escape sequence conversion. JSON supports unicode from # 0020-10FFFF, but this code restricts unicode to 16-bits to remove # ambiguity from Unicon and JSON escape conversion. - # + # # If the unicode is extended ASCII, then return a Unicon hex escape. # Otherwise try to return a unicode escape - # + # ns := tab(many(hex)) | "" if (i := *ns) > 4 then { ns := ns[1:5] @@ -623,7 +623,7 @@ procedure scan_ctrl_char(jerror) end # -# String scanning helper function that identifies a JSON string and +# String scanning helper function that identifies a JSON string and # returns a Unicon string # procedure scan_string(jerror) @@ -632,14 +632,14 @@ procedure scan_string(jerror) while any(~'\"', c := move(1)) do { if c ~== "\\" then str ||:= c - else { + else { if ctrl := scan_ctrl_char(jerror) then str ||:= ctrl else fail } } if move(1) == "\"" then return "\""||str||"\"" else return jerror.set_err( - "JSON string missing terminating double-quotes: " || str) + "JSON string missing terminating double-quotes: " || str) end # @@ -648,14 +648,14 @@ end procedure scan_number(c,jerror) local num_str num_str := "" - + # if negative if c == "-" then { num_str ||:= c c := move(1) } - # integer + # integer if any(&digits,c) then { # append @@ -664,31 +664,31 @@ procedure scan_number(c,jerror) # c is 0 if c == "0" then { # number starting with 0 is either 0, frac, or exp - if any(&digits,move(1)) then - return jerror.set_err("JSON int cannot have leading zero: " || + if any(&digits,move(1)) then + return jerror.set_err("JSON int cannot have leading zero: " || num_str) - } + } # c is 1-9, get all sequential digits - else num_str ||:= tab(many(&digits)) + else num_str ||:= tab(many(&digits)) } - - # fraction + + # fraction if (c := move(1)) == "." then { # append . num_str ||:= c - + # get any/all sequential digits - if not (num_str ||:= tab(many(&digits))) then - return jerror.set_err("Expected digits after '.' in JSON frac: " || + if not (num_str ||:= tab(many(&digits))) then + return jerror.set_err("Expected digits after '.' in JSON frac: " || num_str) } # exponent - if any('eE',c := move(1)) then { - + if any('eE',c := move(1)) then { + # append e|E num_str ||:= c @@ -697,10 +697,10 @@ procedure scan_number(c,jerror) else if (c := move(1)) == "+" then {} # check for sequential digits - if not (num_str ||:= tab(many(&digits))) then + if not (num_str ||:= tab(many(&digits))) then return jerror.set_err("Expected digits after 'e' in JSON exp: " || num_str) - } + } return num_str end @@ -726,9 +726,9 @@ procedure json_parser(token_gen,jerror) initial { parse_funcs := table() - parse_funcs["{"] := parse_object - parse_funcs["["] := parse_array - parse_funcs["\""] := parse_string + parse_funcs["{"] := parse_object + parse_funcs["["] := parse_array + parse_funcs["\""] := parse_string parse_funcs["-"] := parse_number parse_funcs["0"] := parse_number parse_funcs["1"] := parse_number @@ -793,7 +793,7 @@ end # there are delimiting single-quotes within the double-quotes. # procedure parse_string(token, token_gen, parse_funcs, jerror) - if token[2] == "\'" & token[-2] == "\'" then + if token[2] == "\'" & token[-2] == "\'" then return cset(token[3:-2]) else return token[2:-1] @@ -801,7 +801,7 @@ end # # Helper parsing function that recognizes the production rules for a -# JSON object. Returns a Unicon object (table, class, record, set, or cset) +# JSON object. Returns a Unicon object (table, class, record, set, or cset) # if successfully parsed. # procedure parse_object(token, token_gen, parse_funcs, jerror) @@ -809,7 +809,7 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) local constr, attribs, fields, uni_object, i prev_token := token - # {json_object} is a table which holds the traditional JSON dictionary. + # {json_object} is a table which holds the traditional JSON dictionary. # {uni_object} is a unicon object which uses unique JSON object encoding, # "__uniset__", "__unicset__", "__unitable__", "__uniclass__", and # "__unirecord__". {json_object} is always built in case the unique Unicon @@ -817,7 +817,7 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) while tok := @token_gen do { # end of object, allow for trailing comma, e.g. {... ,} if tok == "}" then { - if \constr then + if \constr then return constr ! attribs # class/record else if \uni_object then return uni_object # set/cset @@ -836,21 +836,21 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) else if prev_token == ("{"|",") then { # Dictionary - JSON string as key only if \(jerror.strict) then { - if tok[1] ~== "\"" then + if tok[1] ~== "\"" then return jerror.set_err("Expecting JSON string for object key, "|| "got "||tok) json_key := tok[2:-1] } # For Unicon tables where the key can be any JSON value else { - if /(func := parse_funcs[tok[1]]) then + if /(func := parse_funcs[tok[1]]) then return jerror.set_err("Invalid JSON object key value: "||tok) prev_token := tok json_key := func(tok, token_gen, parse_funcs, jerror) } # Colon - if (tok := @token_gen) == ":" then prev_token := tok + if (tok := @token_gen) == ":" then prev_token := tok else return jerror.set_err("Expected colon in JSON pair before: "||tok) # JSON value @@ -858,7 +858,7 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) if \(func := parse_funcs[tok[1]]) then { json_value := func(tok, token_gen, parse_funcs, jerror) prev_token := "value" - + # Special case for handling Unicon data types if \first then { first := &null @@ -872,36 +872,36 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) next } # {"__uniset__":[...]} - "__uniset__": { - if type(json_value) == "list" then + "__uniset__": { + if type(json_value) == "list" then uni_object := set(json_value) json_object := table() json_object[json_key] := json_value next } # {"__unirecord__":"RecordName", ...} - # + # # Try to create a class/record with its constructor. # If the constructor doesn't exist, return a table instead - "__unirecord__": { + "__unirecord__": { if constr := proc(json_value) then { tmp := constr() fields := [: fieldnames(tmp) :] | [] #fields := [] #every put(fields, fieldnames(tmp)) - attribs := list(*fields) + attribs := list(*fields) next } json_object := table() } # {"__uniclass__":"ClassName", ...} - # + # # Try to create a class with its constructor. # If the constructor doesn't exist, return a table instead - "__uniclass__": { + "__uniclass__": { if constr := proc(json_value) then { fields := membernames(json_value) - attribs := list(*fields) + attribs := list(*fields) next } json_object := table() @@ -917,15 +917,15 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) default: { json_object := table() } - } + } } if \json_object then { # Build a table - if type(\uni_object) ~== "table" then + if type(\uni_object) ~== "table" then uni_object := &null json_object[json_key] := json_value } - else { + else { # Build an attribute list for the class/record constructor. # Check field names in case the JSON was user-constructed # instead of from utoj*() @@ -933,7 +933,7 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) every field := !fields do { if field == json_key then { attribs[i] := json_value - break + break } i +:= 1 } @@ -941,7 +941,7 @@ procedure parse_object(token, token_gen, parse_funcs, jerror) } else return jerror.set_err("Expected JSON value in JSON pair" || ", got: " || tok) - } + } else return jerror.set_err("JSON pair missing JSON value") } else return jerror.set_err("Token violated JSON object syntax: " || tok) @@ -974,22 +974,22 @@ procedure parse_array(token, token_gen, parse_funcs, jerror) # value else if \(func := parse_funcs[tok[1]]) then { - if prev_token == ("["|",") then { + if prev_token == ("["|",") then { json_value := func(tok, token_gen, parse_funcs, jerror) prev_token := "value" - put(json_array, json_value) + put(json_array, json_value) } else return jerror.set_err("Expected comma in JSON array before: " || tok) } - + # invalid array syntax - else { + else { if prev_token == ("["|",") then return jerror.set_err("Expected JSON value, got: " || tok) else - return jerror.set_err("Token violated JSON array syntax: " || - tok) + return jerror.set_err("Token violated JSON array syntax: " || + tok) } } return jerror.set_err("Expected terminating ] for JSON array") @@ -1079,12 +1079,12 @@ procedure jss_validate(data, schema, strict, error) end #

-# +# # Validate a specific value only at the current level given a schema of that value. # # <[param x is the table]> # <[param val is the name of the value of a property]> -# +# # <[returns "" if the valid otherwise returns the error string]> # #

@@ -1203,7 +1203,7 @@ procedure validate_property(x, val) return val || " is too small. Must be greater than or equal to " || minLength || " characters." # TODO - pattern := x["pattern"] + pattern := x["pattern"] return z } } @@ -1304,11 +1304,11 @@ procedure _jsvalidation(obj, sch, schRoot) if check ~== "" then return check inc := inc + 1 } - } + } } } } - } + } else{ pf := validate_property(sch["properties"][k], obj[k]) if pf ~== "" then return pf diff --git a/uni/lib/langprocs.icn b/uni/lib/langprocs.icn index 7a372be89..22eda0730 100644 --- a/uni/lib/langprocs.icn +++ b/uni/lib/langprocs.icn @@ -41,10 +41,10 @@ procedure get_type(object) ::image(object) ? { if ="record " then { return "record" - } + } else { - return ::type(object) - } + return ::type(object) + } } } end @@ -63,7 +63,7 @@ procedure get_name(object) ::image(object) ? { if ="record " then { return ::type(object) - } + } else if ="procedure " then return ::tab(0) else if ="file(" then diff --git a/uni/lib/mapbytes.icn b/uni/lib/mapbytes.icn index 027eea9d6..4564476ce 100644 --- a/uni/lib/mapbytes.icn +++ b/uni/lib/mapbytes.icn @@ -30,10 +30,10 @@ class MapBytes: Object (inM, inMap, outM, outMap, blkSize) method mapIn(s:"") local ns := "" s ? { - while ns ||:= ::map(outMap, inMap, ::move(*inMap)) - while ns ||:= ::map(outM, inM, ::move(*inM)) - ns ||:= ::tab(0) - } + while ns ||:= ::map(outMap, inMap, ::move(*inMap)) + while ns ||:= ::map(outM, inM, ::move(*inM)) + ns ||:= ::tab(0) + } return ns end @@ -45,10 +45,10 @@ class MapBytes: Object (inM, inMap, outM, outMap, blkSize) method mapOut(s:"") local ns := "" s ? { - while ns ||:= ::map(inMap, outMap, ::move(*outMap)) - while ns ||:= ::map(inM, outM, ::move(*outM)) - ns ||:= ::tab(0) - } + while ns ||:= ::map(inMap, outMap, ::move(*outMap)) + while ns ||:= ::map(inM, outM, ::move(*outM)) + ns ||:= ::tab(0) + } return ns end @@ -56,8 +56,8 @@ class MapBytes: Object (inM, inMap, outM, outMap, blkSize) # Copy one file to another with mapping (leaves files open). #

method mapInFile(inFile, # Input file (already opened for reading) - outFile, # Output file (already opened for writing) - blockSize # If present, overrides class' blkSize + outFile, # Output file (already opened for writing) + blockSize # If present, overrides class' blkSize ) blockSize := adjBlockSize(blockSize) while ::writes(outFile, mapIn(::reads(inFile, blockSize))) @@ -67,8 +67,8 @@ class MapBytes: Object (inM, inMap, outM, outMap, blkSize) # Copy one file to another with reverse mapping (leaves files open) #

method mapOutFile(inFile, # Input file (already opened for reading) - outFile, # Output file (already opened for writing) - blockSize # If present, overrides class' blkSize + outFile, # Output file (already opened for writing) + blockSize # If present, overrides class' blkSize ) blockSize := adjBlockSize(blockSize) while ::writes(outFile, mapOut(::reads(inFile, blockSize))) @@ -91,10 +91,10 @@ class MapBytes: Object (inM, inMap, outM, outMap, blkSize) # in a string. Efficiently handles large strings. #

initially(in, # Arrangement of bytes found in input string - out, # Rearrangement of those bytes for output string - blockSize # Default size of file read/write operations (bytes). - # Adjusted automatically to be a multiple of *in. - ) + out, # Rearrangement of those bytes for output string + blockSize # Default size of file read/write operations (bytes). + # Adjusted automatically to be a multiple of *in. + ) inM := \in | "1" outM := \out | in # Default is identity mapping blkSize := 64*1024 # Default is large blocks diff --git a/uni/lib/matrix_util.icn b/uni/lib/matrix_util.icn index 564733ef2..5c9c610d5 100644 --- a/uni/lib/matrix_util.icn +++ b/uni/lib/matrix_util.icn @@ -221,24 +221,24 @@ procedure m_lupDecomposition(M, subfcn, mulfcn, divfcn, if invokeFcn(invertMetric, M[i,k]) > p then { p := ::abs(M[i,k]) k2 := i - } + } if p = 0 then fail b[k] :=: b[k2] every i := 1 to n do - M[k,i] :=: M[k2,i] + M[k,i] :=: M[k2,i] every i := k+1 to n do { - M[i,k] := invokeFcn(divfcn, M[i,k], M[k,k]) | fail - every j := k+1 to n do - M[i,j] := invokeFcn(subfcn,M[i,j],invokeFcn(mulfcn,M[i,k],M[k,j])) - } + M[i,k] := invokeFcn(divfcn, M[i,k], M[k,k]) | fail + every j := k+1 to n do + M[i,j] := invokeFcn(subfcn,M[i,j],invokeFcn(mulfcn,M[i,k],M[k,j])) + } } L := m_constant(*M, *M[1], addident) U := m_constant(*M, *M[1], addident) every (i := 1 to *M, j := 1 to *M[i]) do if i > j then - L[i,j] := M[i,j] + L[i,j] := M[i,j] else - U[i,j] := M[i,j] + U[i,j] := M[i,j] every i := 1 to *M do L[i,i] := mulident return [L,U,b] @@ -265,13 +265,13 @@ procedure m_lupSolve(L,U,p,b,addfun,subfun,mulfun,divfun,addident:0.0) every i := 1 to n do { s := addident every j := 1 to i-1 do - s := invokeFcn(addfun,s,invokeFcn(mulfun,L[i,j],y[j])) + s := invokeFcn(addfun,s,invokeFcn(mulfun,L[i,j],y[j])) y[i] := invokeFcn(subfun,b[p[i]],s) } every i := n to 1 by -1 do { s := addident every j := i+1 to n do - s := invokeFcn(addfun,s,invokeFcn(mulfun,U[i,j],x[j])) + s := invokeFcn(addfun,s,invokeFcn(mulfun,U[i,j],x[j])) x[i] := invokeFcn(divfun,invokeFcn(subfun,y[i],s),U[i,i]) | fail } return x @@ -288,7 +288,7 @@ procedure m_linearSolve(A,b,addfun,subfun,mulfun,divfun, addident,mulident,invertMetric) local lup, L, U, p lup := m_lupDecomposition(A,subfun,mulfun,divfun, - invertMetric,addident,mulident) | fail + invertMetric,addident,mulident) | fail L := lup[1] U := lup[2] p := lup[3] @@ -310,7 +310,7 @@ procedure m_divide(M1,M2,addfun,subfun,mulfun,divfun, X := ::list() every i := 1 to n do { x := m_linearSolve(M2,m_col(M1, i),addfun,subfun,mulfun,divfun, - addident,mulident,invertMetric) | fail + addident,mulident,invertMetric) | fail ::put(X, x) } return m_transpose(X) @@ -326,8 +326,8 @@ end procedure m_inverse(M,addfun,subfun,mulfun,divfun, addident,mulident,invertMetric) return m_divide(m_identity(*M,*M,addident,mulident), - M,addfun,subfun,mulfun,divfun,addident, - mulident,invertMetric) + M,addfun,subfun,mulfun,divfun,addident, + mulident,invertMetric) end #

@@ -344,15 +344,15 @@ procedure m_write(args[]) # Matrices and output files outfile := &output while arg := ::get(args) do { case ::type(arg) of { - "file": outfile := arg - "list": { # Assume it's a matrix! - every i := !M do { - every ::writes(outfile, !i," ") - ::write(outfile) - } - } - default: ::writes(outfile, arg) - } + "file": outfile := arg + "list": { # Assume it's a matrix! + every i := !M do { + every ::writes(outfile, !i," ") + ::write(outfile) + } + } + default: ::writes(outfile, arg) + } } ::write(outfile) end diff --git a/uni/lib/misc_util.icn b/uni/lib/misc_util.icn index 8896fe57c..7e7c8399a 100644 --- a/uni/lib/misc_util.icn +++ b/uni/lib/misc_util.icn @@ -60,19 +60,19 @@ procedure deepcopy(A, cache) case ::type(A) of { "table"|"list": { - cache[A] := ::copy(A) - every cache[A][k := ::key(A)] := deepcopy(A[k], cache) - } + cache[A] := ::copy(A) + every cache[A][k := ::key(A)] := deepcopy(A[k], cache) + } "set": { - cache[A] := ::set() - every ::insert(cache[A], deepcopy(!A, cache)) - } + cache[A] := ::set() + every ::insert(cache[A], deepcopy(!A, cache)) + } default: { - cache[A] := ::copy(A) - if ::match("record ",::image(A)) then { - every cache[A][k := ::key(A)] := deepcopy(A[k], cache) - } - } + cache[A] := ::copy(A) + if ::match("record ",::image(A)) then { + every cache[A][k := ::key(A)] := deepcopy(A[k], cache) + } + } } return .cache[A] end @@ -92,18 +92,18 @@ end # end # procedure breadthwalk(root, # node of graph to start walk at - getChildren) # function that generates a node's children + getChildren) # function that generates a node's children local node, child, queue, visited /getChildren := defaultGenChildren queue := [root] visited := ::set([root]) while node := ::get(queue) do { every child := getChildren(node) do { - if not ::member(visited, child) then { - ::insert(visited, child) - ::put(queue, child) - } - } + if not ::member(visited, child) then { + ::insert(visited, child) + ::put(queue, child) + } + } suspend node } end @@ -127,8 +127,8 @@ end # be given by the user. #

procedure depthwalk(root, # node of graph to start walk at - getChildren, # function that generates a node's children - visited) # ignore, used internally. + getChildren, # function that generates a node's children + visited) # ignore, used internally. /getChildren := defaultGenChildren /visited := ::set() if not ::member(visited, root) then { diff --git a/uni/lib/msgutils.icn b/uni/lib/msgutils.icn index 10ad50352..bdde44363 100644 --- a/uni/lib/msgutils.icn +++ b/uni/lib/msgutils.icn @@ -1,12 +1,12 @@ ############################################################################ # -# File: msgutils.icn +# File: msgutils.icn # -# Subject: Miscellaneous routines for messaging +# Subject: Miscellaneous routines for messaging # -# Author: Steve Lumos +# Author: Steve Lumos # -# Date: 22 Apr 2000 +# Date: 22 Apr 2000 # ############################################################################ # @@ -26,21 +26,21 @@ procedure FormOpen(url, fields) boundry := "--" every 1 to 30 do boundry ||:= ?(&letters++&digits) - + formdata := boundry every nam := key(fields) do { - formdata ||:= "\r\n" || - "Content-Disposition: form-data; name=\"" || nam || "\"\r\n" || - "Content-Type: text/plain\r\n" || "\r\n" - formdata ||:= fields[nam] || "\r\n" - formdata ||:= boundry + formdata ||:= "\r\n" || + "Content-Disposition: form-data; name=\"" || nam || "\"\r\n" || + "Content-Type: text/plain\r\n" || "\r\n" + formdata ||:= fields[nam] || "\r\n" + formdata ||:= boundry } formdata ||:= "--\r\n" - web := open(url, "m", - "Content-Type: multipart/form-data; " || + web := open(url, "m", + "Content-Type: multipart/form-data; " || "boundry=" || boundry[3:0], - "Content-Length: " || *formdata) + "Content-Length: " || *formdata) writes(web, formdata) return web end @@ -54,19 +54,19 @@ procedure UploadFile(filename, url) f := open(filename) | fail if match(typ, "text/") then { - enc := "7bit" - s := reads(f, 1000000) + enc := "7bit" + s := reads(f, 1000000) } else { - enc := "base64" - s := base64encode(reads(f, 10000000)) + enc := "base64" + s := base64encode(reads(f, 10000000)) } - close(f) + close(f) server := open(url, "m", - "Content-Type: " || typ, - "Content-Transfer-Encoding: " || enc, - "Content-Length: " || *s) | fail + "Content-Type: " || typ, + "Content-Transfer-Encoding: " || enc, + "Content-Length: " || *s) | fail writes(server, s) return server end @@ -77,132 +77,132 @@ procedure ContentType(filename) local ext initial { - typemap := table("application/octet-stream") + typemap := table("application/octet-stream") - # These are from the mime.types included with Apache - typemap["ez"] := "application/andrew-inset" - typemap["hqx"] := "application/mac-binhex40" - typemap["cpt"] := "application/mac-compactpro" - typemap["doc"] := "application/msword" - typemap["oda"] := "application/oda" - typemap["pdf"] := "application/pdf" - typemap["ai"] := "application/postscript" - typemap["ps"] := "application/postscript" - typemap["eps"] := "application/postscript" - typemap["rtf"] := "application/rtf" - typemap["smi"] := "application/smil" - typemap["smil"] := "application/smil" - typemap["mif"] := "application/vnd.mif" - typemap["xls"] := "application/vnd.ms-excel" - typemap["ppt"] := "application/vnd.ms-powerpoint" - typemap["bcpio"] := "application/x-bcpio" - typemap["vcd"] := "application/x-cdlink" - typemap["pgn"] := "application/x-chess-pgn" - typemap["cpio"] := "application/x-cpio" - typemap["csh"] := "application/x-csh" - typemap["dcr"] := "application/x-director" - typemap["dir"] := "application/x-director" - typemap["dxr"] := "application/x-director" - typemap["dvi"] := "application/x-dvi" - typemap["spl"] := "application/x-futuresplash" - typemap["gtar"] := "application/x-gtar" - typemap["hdf"] := "application/x-hdf" - typemap["js"] := "application/x-javascript" - typemap["skp"] := "application/x-koan" - typemap["skd"] := "application/x-koan" - typemap["skt"] := "application/x-koan" - typemap["skm"] := "application/x-koan" - typemap["latex"] := "application/x-latex" - typemap["nc"] := "application/x-netcdf" - typemap["cdf"] := "application/x-netcdf" - typemap["sh"] := "application/x-sh" - typemap["shar"] := "application/x-shar" - typemap["swf"] := "application/x-shockwave-flash" - typemap["sit"] := "application/x-stuffit" - typemap["sv4cpio"] := "application/x-sv4cpio" - typemap["sv4crc"] := "application/x-sv4crc" - typemap["tar"] := "application/x-tar" - typemap["tcl"] := "application/x-tcl" - typemap["tex"] := "application/x-tex" - typemap["texi"] := "application/x-texinfo" - typemap["texinfo"] := "application/x-texinfo" - typemap["t"] := "application/x-troff" - typemap["tr"] := "application/x-troff" - typemap["roff"] := "application/x-troff" - typemap["man"] := "application/x-troff-man" - typemap["me"] := "application/x-troff-me" - typemap["ms"] := "application/x-troff-ms" - typemap["ustar"] := "application/x-ustar" - typemap["src"] := "application/x-wais-source" - typemap["zip"] := "application/zip" - typemap["au"] := "audio/basic" - typemap["snd"] := "audio/basic" - typemap["mid"] := "audio/midi" - typemap["midi"] := "audio/midi" - typemap["kar"] := "audio/midi" - typemap["mpga"] := "audio/mpeg" - typemap["mp2"] := "audio/mpeg" - typemap["mp3"] := "audio/mpeg" - typemap["aif"] := "audio/x-aiff" - typemap["aiff"] := "audio/x-aiff" - typemap["aifc"] := "audio/x-aiff" - typemap["ram"] := "audio/x-pn-realaudio" - typemap["rm"] := "audio/x-pn-realaudio" - typemap["rpm"] := "audio/x-pn-realaudio-plugin" - typemap["ra"] := "audio/x-realaudio" - typemap["wav"] := "audio/x-wav" - typemap["pdb"] := "chemical/x-pdb" - typemap["xyz"] := "chemical/x-pdb" - typemap["bmp"] := "image/bmp" - typemap["gif"] := "image/gif" - typemap["ief"] := "image/ief" - typemap["jpeg"] := "image/jpeg" - typemap["jpg"] := "image/jpeg" - typemap["jpe"] := "image/jpeg" - typemap["png"] := "image/png" - typemap["tiff"] := "image/tiff" - typemap["tif"] := "image/tiff" - typemap["ras"] := "image/x-cmu-raster" - typemap["pnm"] := "image/x-portable-anymap" - typemap["pbm"] := "image/x-portable-bitmap" - typemap["pgm"] := "image/x-portable-graymap" - typemap["ppm"] := "image/x-portable-pixmap" - typemap["rgb"] := "image/x-rgb" - typemap["xbm"] := "image/x-xbitmap" - typemap["xpm"] := "image/x-xpixmap" - typemap["xwd"] := "image/x-xwindowdump" - typemap["igs"] := "model/iges" - typemap["iges"] := "model/iges" - typemap["msh"] := "model/mesh" - typemap["mesh"] := "model/mesh" - typemap["silo"] := "model/mesh" - typemap["wrl"] := "model/vrml" - typemap["vrml"] := "model/vrml" - typemap["css"] := "text/css" - typemap["html"] := "text/html" - typemap["htm"] := "text/html" - typemap["asc"] := "text/plain" - typemap["txt"] := "text/plain" - typemap["rtx"] := "text/richtext" - typemap["rtf"] := "text/rtf" - typemap["sgml"] := "text/sgml" - typemap["sgm"] := "text/sgml" - typemap["tsv"] := "text/tab-separated-values" - typemap["etx"] := "text/x-setext" - typemap["xml"] := "text/xml" - typemap["mpeg"] := "video/mpeg" - typemap["mpg"] := "video/mpeg" - typemap["mpe"] := "video/mpeg" - typemap["qt"] := "video/quicktime" - typemap["mov"] := "video/quicktime" - typemap["avi"] := "video/x-msvideo" - typemap["movie"] := "video/x-sgi-movie" - typemap["ice"] := "x-conference/x-cooltalk" + # These are from the mime.types included with Apache + typemap["ez"] := "application/andrew-inset" + typemap["hqx"] := "application/mac-binhex40" + typemap["cpt"] := "application/mac-compactpro" + typemap["doc"] := "application/msword" + typemap["oda"] := "application/oda" + typemap["pdf"] := "application/pdf" + typemap["ai"] := "application/postscript" + typemap["ps"] := "application/postscript" + typemap["eps"] := "application/postscript" + typemap["rtf"] := "application/rtf" + typemap["smi"] := "application/smil" + typemap["smil"] := "application/smil" + typemap["mif"] := "application/vnd.mif" + typemap["xls"] := "application/vnd.ms-excel" + typemap["ppt"] := "application/vnd.ms-powerpoint" + typemap["bcpio"] := "application/x-bcpio" + typemap["vcd"] := "application/x-cdlink" + typemap["pgn"] := "application/x-chess-pgn" + typemap["cpio"] := "application/x-cpio" + typemap["csh"] := "application/x-csh" + typemap["dcr"] := "application/x-director" + typemap["dir"] := "application/x-director" + typemap["dxr"] := "application/x-director" + typemap["dvi"] := "application/x-dvi" + typemap["spl"] := "application/x-futuresplash" + typemap["gtar"] := "application/x-gtar" + typemap["hdf"] := "application/x-hdf" + typemap["js"] := "application/x-javascript" + typemap["skp"] := "application/x-koan" + typemap["skd"] := "application/x-koan" + typemap["skt"] := "application/x-koan" + typemap["skm"] := "application/x-koan" + typemap["latex"] := "application/x-latex" + typemap["nc"] := "application/x-netcdf" + typemap["cdf"] := "application/x-netcdf" + typemap["sh"] := "application/x-sh" + typemap["shar"] := "application/x-shar" + typemap["swf"] := "application/x-shockwave-flash" + typemap["sit"] := "application/x-stuffit" + typemap["sv4cpio"] := "application/x-sv4cpio" + typemap["sv4crc"] := "application/x-sv4crc" + typemap["tar"] := "application/x-tar" + typemap["tcl"] := "application/x-tcl" + typemap["tex"] := "application/x-tex" + typemap["texi"] := "application/x-texinfo" + typemap["texinfo"] := "application/x-texinfo" + typemap["t"] := "application/x-troff" + typemap["tr"] := "application/x-troff" + typemap["roff"] := "application/x-troff" + typemap["man"] := "application/x-troff-man" + typemap["me"] := "application/x-troff-me" + typemap["ms"] := "application/x-troff-ms" + typemap["ustar"] := "application/x-ustar" + typemap["src"] := "application/x-wais-source" + typemap["zip"] := "application/zip" + typemap["au"] := "audio/basic" + typemap["snd"] := "audio/basic" + typemap["mid"] := "audio/midi" + typemap["midi"] := "audio/midi" + typemap["kar"] := "audio/midi" + typemap["mpga"] := "audio/mpeg" + typemap["mp2"] := "audio/mpeg" + typemap["mp3"] := "audio/mpeg" + typemap["aif"] := "audio/x-aiff" + typemap["aiff"] := "audio/x-aiff" + typemap["aifc"] := "audio/x-aiff" + typemap["ram"] := "audio/x-pn-realaudio" + typemap["rm"] := "audio/x-pn-realaudio" + typemap["rpm"] := "audio/x-pn-realaudio-plugin" + typemap["ra"] := "audio/x-realaudio" + typemap["wav"] := "audio/x-wav" + typemap["pdb"] := "chemical/x-pdb" + typemap["xyz"] := "chemical/x-pdb" + typemap["bmp"] := "image/bmp" + typemap["gif"] := "image/gif" + typemap["ief"] := "image/ief" + typemap["jpeg"] := "image/jpeg" + typemap["jpg"] := "image/jpeg" + typemap["jpe"] := "image/jpeg" + typemap["png"] := "image/png" + typemap["tiff"] := "image/tiff" + typemap["tif"] := "image/tiff" + typemap["ras"] := "image/x-cmu-raster" + typemap["pnm"] := "image/x-portable-anymap" + typemap["pbm"] := "image/x-portable-bitmap" + typemap["pgm"] := "image/x-portable-graymap" + typemap["ppm"] := "image/x-portable-pixmap" + typemap["rgb"] := "image/x-rgb" + typemap["xbm"] := "image/x-xbitmap" + typemap["xpm"] := "image/x-xpixmap" + typemap["xwd"] := "image/x-xwindowdump" + typemap["igs"] := "model/iges" + typemap["iges"] := "model/iges" + typemap["msh"] := "model/mesh" + typemap["mesh"] := "model/mesh" + typemap["silo"] := "model/mesh" + typemap["wrl"] := "model/vrml" + typemap["vrml"] := "model/vrml" + typemap["css"] := "text/css" + typemap["html"] := "text/html" + typemap["htm"] := "text/html" + typemap["asc"] := "text/plain" + typemap["txt"] := "text/plain" + typemap["rtx"] := "text/richtext" + typemap["rtf"] := "text/rtf" + typemap["sgml"] := "text/sgml" + typemap["sgm"] := "text/sgml" + typemap["tsv"] := "text/tab-separated-values" + typemap["etx"] := "text/x-setext" + typemap["xml"] := "text/xml" + typemap["mpeg"] := "video/mpeg" + typemap["mpg"] := "video/mpeg" + typemap["mpe"] := "video/mpeg" + typemap["qt"] := "video/quicktime" + typemap["mov"] := "video/quicktime" + typemap["avi"] := "video/x-msvideo" + typemap["movie"] := "video/x-sgi-movie" + typemap["ice"] := "x-conference/x-cooltalk" } filename ? { - while tab(upto('.')+1) - ext := tab(0) + while tab(upto('.')+1) + ext := tab(0) } return typemap[ext] diff --git a/uni/lib/notifier.icn b/uni/lib/notifier.icn index 495e4eaf2..40bc61d28 100644 --- a/uni/lib/notifier.icn +++ b/uni/lib/notifier.icn @@ -95,10 +95,10 @@ class Notifier:Object(listeners) if lang::Type(l.obj)\1 == "string" then { # Special case if ::proc(l.obj) === listener then disconnect(l) } - else if (l.obj === listener) then { + else if (l.obj === listener) then { if lang::isClass(listener) & - (l.meth === lang::find_method(listener, methodname)) then { - disconnect(l) + (l.meth === lang::find_method(listener, methodname)) then { + disconnect(l) } else { disconnect(l) @@ -153,8 +153,8 @@ class Notifier:Object(listeners) } # omit duplicate requests every l := genListeners(typ) do - if (l.obj === obj) & (l.meth === p) then - fail + if (l.obj === obj) & (l.meth === p) then + fail l := Subscription(obj, p, typ) addToListeners(l) @@ -194,19 +194,19 @@ class Notifier:Object(listeners) #

method notify1(l, message) case ::type(l.obj) of { - "procedure" | "string" : l.obj(lang::Type(self)\1, l.type, message) - "co-expression" : [lang::Type(self)\1, l.type , message] @ l.obj - # list invocation here uses substitution rules per future UniLib - # integration. This probably won't work well until that happens. - "list": { + "procedure" | "string" : l.obj(lang::Type(self)\1, l.type, message) + "co-expression" : [lang::Type(self)\1, l.type , message] @ l.obj + # list invocation here uses substitution rules per future UniLib + # integration. This probably won't work well until that happens. + "list": { a := ::copy(l.obj) - fcn := ::pop(a) - args := [lang::Type(self)\1, l.type, param] - every i := 1 to *a do if a[i] === Arg then a[i] := ::pop(args) - suspend fcn ! a - } - default: if lang::isClass(l.obj) then notifyClass(l, message) - } + fcn := ::pop(a) + args := [lang::Type(self)\1, l.type, param] + every i := 1 to *a do if a[i] === Arg then a[i] := ::pop(args) + suspend fcn ! a + } + default: if lang::isClass(l.obj) then notifyClass(l, message) + } end #

diff --git a/uni/lib/object.icn b/uni/lib/object.icn index 8479aeabe..b4a9baa5d 100644 --- a/uni/lib/object.icn +++ b/uni/lib/object.icn @@ -91,7 +91,7 @@ class Object() # <[returns the classname for the current class in package::class format]> #

method className() - return lang::mapPackageInt2Ext(::classname(self)) + return lang::mapPackageInt2Ext(::classname(self)) end #

@@ -100,10 +100,10 @@ class Object() # <[fails if no method exists with that name]> #

method invoke(mName, # Name of method to call - args[]) # Remaining arguments are arguments to call + args[]) # Remaining arguments are arguments to call if hasMethod(mName) then { - suspend (self.__m[mName]) ! ::push(args, self) - } + suspend (self.__m[mName]) ! ::push(args, self) + } end #

@@ -112,8 +112,8 @@ class Object() #

method getField(fName) # name of field if hasField(fName) then { - return self[fName] - } + return self[fName] + } end #

@@ -122,10 +122,10 @@ class Object() # <[fails if no field fName]> #

method setField(fName, # name of field - value) # value to set field to + value) # value to set field to if hasField(fName) then { - return .(self[fName] := value) - } + return .(self[fName] := value) + } end #

diff --git a/uni/lib/pqueue.icn b/uni/lib/pqueue.icn index faa30e7ec..d71dc3ff3 100644 --- a/uni/lib/pqueue.icn +++ b/uni/lib/pqueue.icn @@ -19,37 +19,37 @@ # # Methods: # -# construct(S) returns a max-priority queue containing the elements -# in the structure (list, table, or set) S of "elem" +# construct(S) returns a max-priority queue containing the elements +# in the structure (list, table, or set) S of "elem" # records, each containing a "data" and a numeric # "priority" field. # -# get() removes and returns the highest priority element -# from the priority queue. +# get() removes and returns the highest priority element +# from the priority queue. # -# put(e) adds element e (a "elem" record) to the queue. +# put(e) adds element e (a "elem" record) to the queue. # -# gen() generates (non-destructively) the elements of the queue +# gen() generates (non-destructively) the elements of the queue # in order, highest priority first. # # len() returns the number of elements in the queue. # maxlen() returns the maximum length reached by the queue during # its lifetime. # -# elem(d, p) constructs a record with data d and priority p. +# elem(d, p) constructs a record with data d and priority p. # # ############################################################################ # -# The priority queue is implemented as a max-heap. The heap is -# implemented by a list in the usual fashion. +# The priority queue is implemented as a max-heap. The heap is +# implemented by a list in the usual fashion. # ############################################################################ class MaxPQueue(Q, elem, L) # Create the queue from a list, table, or set of "elem" - method construct(S) + method construct(S) local i /S := list() Q := list() @@ -86,7 +86,7 @@ class MaxPQueue(Q, elem, L) end # Generate the elements - method gen() + method gen() local q, e q := copy(Q) while e := copy(self.get(q)) do @@ -100,7 +100,7 @@ class MaxPQueue(Q, elem, L) right := left + 1 if Q[left].priority > Q[i].priority then largest := left - else + else largest := i if Q[right].priority > Q[largest].priority then largest := right if largest ~= i then { diff --git a/uni/lib/rfc822pr.icn b/uni/lib/rfc822pr.icn index c11e2c131..2e62a5349 100644 --- a/uni/lib/rfc822pr.icn +++ b/uni/lib/rfc822pr.icn @@ -1,12 +1,12 @@ ############################################################################ # -# File: rfc822pr.icn +# File: rfc822pr.icn # -# Subject: RFC 822 e-mail header parsing +# Subject: RFC 822 e-mail header parsing # -# Author: Robert Parlett +# Author: Robert Parlett # -# Date: 15 April, 2002 +# Date: 15 April, 2002 # ############################################################################ # diff --git a/uni/lib/scan_util.icn b/uni/lib/scan_util.icn index 0ca33720a..ed1988450 100644 --- a/uni/lib/scan_util.icn +++ b/uni/lib/scan_util.icn @@ -134,9 +134,9 @@ class FindFirst : Object(fchars,cMaps,subs,lastMatch) /i := &pos /j := 0 if *\s > 0 then { - suspend 1(p := ::upto(fchars,s,i,j), - ::match(lastMatch <- !cMaps[s[p]],s,p,j)) - } + suspend 1(p := ::upto(fchars,s,i,j), + ::match(lastMatch <- !cMaps[s[p]],s,p,j)) + } end #

@@ -176,10 +176,10 @@ class FindFirst : Object(fchars,cMaps,subs,lastMatch) cMaps := ::table() fchars := '' every k := !subs do { - fchars ++:= k[1] - /cMaps[k[1]] := [] - ::put(cMaps[k[1]], k) - } + fchars ++:= k[1] + /cMaps[k[1]] := [] + ::put(cMaps[k[1]], k) + } lastMatch := &null end @@ -305,13 +305,13 @@ procedure sbal(keyStrings) p1 := &pos w := ff.moveMatch() if ::member(startStrings, w) then { - if (inside +:= 1) = 1 then sPos := p1 - } + if (inside +:= 1) = 1 then sPos := p1 + } else if ::member(stopStrings, w) then { - if (inside -:= 1) = 0 then { - suspend .&subject[sPos:&pos] - } - } + if (inside -:= 1) = 0 then { + suspend .&subject[sPos:&pos] + } + } if inside < 0 then fail } end diff --git a/uni/lib/soap_util.icn b/uni/lib/soap_util.icn index 511b0e9fb..b13d4721e 100644 --- a/uni/lib/soap_util.icn +++ b/uni/lib/soap_util.icn @@ -12,7 +12,7 @@ package soap -import util # does it use this, or just lang:: +import util # does it use this, or just lang:: import xml # From Robert Parlett's class library #

@@ -65,8 +65,8 @@ procedure getNonWSChildren(x) every e := !x.get_children() do { if ::type(e) ~== "string" then { - ::put(a, e) - } + ::put(a, e) + } } return a end @@ -94,13 +94,13 @@ procedure encode(x, # Message element else if lang::istype(x, "table"|"record") then { s := "\n"||prefix||"<"||label||">\n" every k := ::key(x) do { - s ||:= prefix||" "||encode(x[k], prefix,i,k)||"\n" - } + s ||:= prefix||" "||encode(x[k], prefix,i,k)||"\n" + } s ||:= prefix||"\n" } else if lang::istype(x, "list") then { s := "\n"||prefix||"<"||label||" xsi:type=\"SOAP-ENC:Array\" "|| - " SOAP-ENC:arrayType=\"xsd:ur-type["||*x||"]\">\n" + " SOAP-ENC:arrayType=\"xsd:ur-type["||*x||"]\">\n" every s ||:= encode(!x, prefix||" ", i) || "\n" s ||:= prefix||"\n" } @@ -140,16 +140,16 @@ procedure decode(x) "integer" : return ::integer(x.get_children()[1]) "null" : return &null "list" : { - every ::put(a := [], decode(!getNonWSChildren(x))) - return a - } + every ::put(a := [], decode(!getNonWSChildren(x))) + return a + } "table" : { - a := ::table() - every child := !getNonWSChildren(x) do { - a[child.get_name()] := decode(child) - } - return a - } + a := ::table() + every child := !getNonWSChildren(x) do { + a[child.get_name()] := decode(child) + } + return a + } } return x[1] end @@ -176,15 +176,15 @@ procedure getElementType(x) a := x.get_attributes() every k := ::key(a) do { k ? { - &pos := ::upto(':')+1 # skip any namespace id - if ="type" & ::pos(0) then { - a[k] ? { - &pos := ::any('\'"') - &pos := ::upto(':')+1 # skip any namespace id - return typeMap[::map(::tab(::upto('\'"')|0))] - } - } - } + &pos := ::upto(':')+1 # skip any namespace id + if ="type" & ::pos(0) then { + a[k] ? { + &pos := ::any('\'"') + &pos := ::upto(':')+1 # skip any namespace id + return typeMap[::map(::tab(::upto('\'"')|0))] + } + } + } } return "table" # wild guess! end @@ -224,9 +224,9 @@ class ErrHandler : xml::DefaultErrorHandler (out_file) method fatal_error(msg:"", stack) ::writes(\out_file, "Fatal error: " || msg) if \stack then { - ::write(\out_file, " at:") - show_stack(stack) - } + ::write(\out_file, " at:") + show_stack(stack) + } end #

@@ -252,13 +252,13 @@ class ErrHandler : xml::DefaultErrorHandler (out_file) local x, i, t every x := !stack do { - if \x.id then { - t := x.subject[1:x.pos] - i := 1 - every ::find("\n", t) do i +:= 1 - ::write(\out_file, x.id || ": "||i) - } - } + if \x.id then { + t := x.subject[1:x.pos] + i := 1 + every ::find("\n", t) do i +:= 1 + ::write(\out_file, x.id || ": "||i) + } + } end initially () diff --git a/uni/lib/soapclient.icn b/uni/lib/soapclient.icn index bb02885d7..afe509167 100644 --- a/uni/lib/soapclient.icn +++ b/uni/lib/soapclient.icn @@ -48,8 +48,8 @@ class SoapClient : Object (uri, proxy, port, debugFile) #

method setDebugFile(f) if ::type(f) == "string" then { - f := ::open(f, "w") | fail - } + f := ::open(f, "w") | fail + } debugFile := f end @@ -69,7 +69,7 @@ class SoapClient : Object (uri, proxy, port, debugFile) # <[returns result of RPC call]> #

method call(rpc, # Name of remote service to invoke - args[]) # Remaining arguments are arguments to use on rpc + args[]) # Remaining arguments are arguments to use on rpc local msg, host, svc, result msg := buildSoapMsg ! ([rpc] ||| args) msg := mkHttpMesgForm(msg) @@ -77,7 +77,7 @@ class SoapClient : Object (uri, proxy, port, debugFile) host := getHost() | ::stop("Cannot figure out host!") svc := ::open(host||":"||port, "n") | - ::stop("Cannot get '",host,"' connection: ", &errortext) + ::stop("Cannot get '",host,"' connection: ", &errortext) ::write(svc, msg) | ::stop("Cannot send msg: ",&errortext) result := "" @@ -104,10 +104,10 @@ class SoapClient : Object (uri, proxy, port, debugFile) initial parser := soap::getXmlParser() ::map(result) ? { - if p := ::find("Internal use only.

method getHost() proxy ? { - ="http://" - return ::tab(::upto('/')) - } + ="http://" + return ::tab(::upto('/')) + } end #

@@ -134,9 +134,9 @@ class SoapClient : Object (uri, proxy, port, debugFile) #

Internal use only.

method getTarget() proxy ? { - ="http://" - (&pos := ::upto('/')) & return ::tab(0) - } + ="http://" + (&pos := ::upto('/')) & return ::tab(0) + } end #

@@ -145,7 +145,7 @@ class SoapClient : Object (uri, proxy, port, debugFile) #

#

Internal use only.

method buildSoapMsg(rpc, # Name of remote service to invoke - args[]) # Remaining args are args to use on rpc + args[]) # Remaining args are args to use on rpc local msg, i i := create ::seq() @@ -181,8 +181,8 @@ class SoapClient : Object (uri, proxy, port, debugFile) # Create a new SOAP client. #

initially (newUri, # URI for server - newProxy, # 'Proxy' information for server (defaults to URI) - newPort) # Port on server (defaults to 80) + newProxy, # 'Proxy' information for server (defaults to URI) + newPort) # Port on server (defaults to 80) uri := newUri proxy := \newProxy | uri port := \newPort | ::getserv("http").port | "80" diff --git a/uni/lib/soapserver.icn b/uni/lib/soapserver.icn index 1671ff388..9cc539d04 100644 --- a/uni/lib/soapserver.icn +++ b/uni/lib/soapserver.icn @@ -75,8 +75,8 @@ class SoapServer : Object(uri, # URI of service #

method setDebugFile(f) # File name or open file. if ::type(f) == "string" then { - f := ::open(f, "w") | fail - } + f := ::open(f, "w") | fail + } debugFile := f end @@ -84,8 +84,8 @@ class SoapServer : Object(uri, # URI of service # Add a service. #

method addService(sName, # Name of service - func, # Procedure implementing service - helpMsg) # (Optional) help message + func, # Procedure implementing service + helpMsg) # (Optional) help message services[sName] := func servicesHelp[sName] := \helpMsg end @@ -99,8 +99,8 @@ class SoapServer : Object(uri, # URI of service # <result>...</result> element.) #

method addSpecialService(sName, # Name of service - func, # Procedure implementing service - helpMsg) # (Optional) help message + func, # Procedure implementing service + helpMsg) # (Optional) help message addService(sName, func, helpMsg) ::insert(specialServices, sName) end @@ -121,8 +121,8 @@ class SoapServer : Object(uri, # URI of service method listServices() local aList := [], sName every sName := (!::sort(services))[1] do { - ::put(aList, ::left(sName,30)||(\servicesHelp[sName] | "")) - } + ::put(aList, ::left(sName,30)||(\servicesHelp[sName] | "")) + } return aList end @@ -144,7 +144,7 @@ class SoapServer : Object(uri, # URI of service #

#

Internal use only.

method invokeService(sName, # Name of service - aList) # List of arguments for service + aList) # List of arguments for service return (getService(sName) ! aList) end @@ -160,35 +160,35 @@ class SoapServer : Object(uri, # URI of service initial Fmt := xml::XmlFormatter() if request := getRequest() then { - debugMsg("Request: ",Fmt.format_document(request,0)) - children := request.get_children() - debugMsg("Children: ",image(children)) - (svc := (!children), ::type(svc) ~== "string") - debugMsg("SVC: ",::image(svc)) - sName := svc.get_name() - sName ?:= 2(skipTo(::upto(':')+1),::tab(0)) - debugMsg("Name: ",sName) - arglist := [] - every param := !soap::getNonWSChildren(svc) do { - ::put(arglist, soap::decode(param)) - } - debugMsg("Param count: ",*arglist) - if sName == "listServices" then { - return respond(listServices()) - } - else if msg := invokeService(sName, arglist) then { - if not ::member(specialServices, sName) then { - return respond(msg) - } - else { - return respondSpecial(msg) - } - } - else { - return error("SOAP-ENV:Server", - "Unknown service '"||sName||"'.") - } - } + debugMsg("Request: ",Fmt.format_document(request,0)) + children := request.get_children() + debugMsg("Children: ",image(children)) + (svc := (!children), ::type(svc) ~== "string") + debugMsg("SVC: ",::image(svc)) + sName := svc.get_name() + sName ?:= 2(skipTo(::upto(':')+1),::tab(0)) + debugMsg("Name: ",sName) + arglist := [] + every param := !soap::getNonWSChildren(svc) do { + ::put(arglist, soap::decode(param)) + } + debugMsg("Param count: ",*arglist) + if sName == "listServices" then { + return respond(listServices()) + } + else if msg := invokeService(sName, arglist) then { + if not ::member(specialServices, sName) then { + return respond(msg) + } + else { + return respondSpecial(msg) + } + } + else { + return error("SOAP-ENV:Server", + "Unknown service '"||sName||"'.") + } + } end #

@@ -197,9 +197,9 @@ class SoapServer : Object(uri, # URI of service #

#

Internal use only.

method error(code, # SOAP error code - msg) # Error message text + msg) # Error message text msg := " \n" || - " "||code||"\n" || + " "||code||"\n" || " "||msg||"\n" || " \n" return respondSpecial(msg) @@ -216,11 +216,11 @@ class SoapServer : Object(uri, # URI of service initial parser := soap::getXmlParser() if ::getenv("REQUEST_METHOD") == "GET" then { - line := ::getenv("QUERY_STRING") - } + line := ::getenv("QUERY_STRING") + } else { - line := ::reads(&input, ::getenv("CONTENT_LENGTH")) - } + line := ::reads(&input, ::getenv("CONTENT_LENGTH")) + } debugMsg("Got: '",line,"'") root := parser.parse(line).get_root_element() return root.search_children("SOAP-ENV:Body") @@ -253,7 +253,7 @@ class SoapServer : Object(uri, # URI of service local res res := soap::soapHead() || - " \n" || + " \n" || response || " \n" || soap::soapTail() @@ -282,7 +282,7 @@ class SoapServer : Object(uri, # URI of service # to procedures. #

initially (newUri, # URI indentifying server - newServices) # (Optional) table mapping procedures to services + newServices) # (Optional) table mapping procedures to services uri := newUri services := \newServices | ::table() servicesHelp := ::table() diff --git a/uni/lib/sql.icn b/uni/lib/sql.icn index 614a1c157..5a465da03 100644 --- a/uni/lib/sql.icn +++ b/uni/lib/sql.icn @@ -6,14 +6,14 @@ # Received: from lonestar.jpl.utsa.edu (129.115.120.1) # by koko.egr.unlv.edu with SMTP; 16 May 2000 19:56:43 -0000 # Received: from localhost (fbalbi@localhost) -# by lonestar.jpl.utsa.edu (8.9.1/8.9.1) with ESMTP id OAA05480; -# Tue, 16 May 2000 14:52:58 -0500 (CDT) +# by lonestar.jpl.utsa.edu (8.9.1/8.9.1) with ESMTP id OAA05480; +# Tue, 16 May 2000 14:52:58 -0500 (CDT) # Date: Tue, 16 May 2000 14:52:58 -0500 (CDT) # From: Federico Balbi -# To: Clinton Jeffery , +# To: Clinton Jeffery , # Phillip Thomas # Subject: utility -# +# # if you plan to use MySQL w/ Icon I give you this procedure to escape # strings. In fact, if you do not do it, you can have wrong queries. # i tested a little bit and it's doing OK. If you find any bugs please do @@ -53,7 +53,7 @@ procedure escape(s) end # #---------------------------------------------------------------------------- -# Federico Balbi - University of Texas at San Antonio -# e-mail: fbalbi@lonestar.utsa.edu - URL: http://www.geocities.com/fedebalbi +# Federico Balbi - University of Texas at San Antonio +# e-mail: fbalbi@lonestar.utsa.edu - URL: http://www.geocities.com/fedebalbi diff --git a/uni/lib/str_replacer.icn b/uni/lib/str_replacer.icn index b2d5da799..b382a6258 100644 --- a/uni/lib/str_replacer.icn +++ b/uni/lib/str_replacer.icn @@ -34,11 +34,11 @@ class StringReplacer : Object (tbl, ff) method replace(s) local ns := "" s ? { - while ns ||:= ::tab(ff.locate()) do { - ns ||:= tbl[ff.moveMatch()] - } - ns ||:= ::tab(0) - } + while ns ||:= ::tab(ff.locate()) do { + ns ||:= tbl[ff.moveMatch()] + } + ns ||:= ::tab(0) + } return ns end diff --git a/uni/lib/struct.icn b/uni/lib/struct.icn index 401afb4a5..dc46deca6 100644 --- a/uni/lib/struct.icn +++ b/uni/lib/struct.icn @@ -76,13 +76,13 @@ class Struct : Object (sType, struct) method fromString(s, prefix:"", terminator:'\n') terminator := cset(terminator) ::string(s) ? { - struct := sType() # Clear out old, if any - while not ::pos(0) do { - =prefix - addElement(::tab(::upto(terminator)|0)) - ::move(1) # skip terminator - } - } + struct := sType() # Clear out old, if any + while not ::pos(0) do { + =prefix + addElement(::tab(::upto(terminator)|0)) + ::move(1) # skip terminator + } + } return self end diff --git a/uni/lib/thread.icn b/uni/lib/thread.icn index bd908574a..cdc0b17fb 100644 --- a/uni/lib/thread.icn +++ b/uni/lib/thread.icn @@ -64,7 +64,7 @@ procedure channel(x, port) if ::member(chTableN, x) then chnl := chTableN[x] else - chTableN[x] := chnl := ::condvar([]) + chTableN[x] := chnl := ::condvar([]) return chnl } @@ -74,16 +74,16 @@ procedure channel(x, port) if not(::member(chTable, ce)) then chTable[ce] := ::table() if not(::member(chTable, x)) then chTable[x] := ::table() - if \(L := chTable[ce][x]) & chnl := ::get(L) then { - if *L=0 then ::delete(chTable[ce], x) - } - else if \(L := chTable[x][ce]) then - ::put(L, chnl := ::condvar([])) + if \(L := chTable[ce][x]) & chnl := ::get(L) then { + if *L=0 then ::delete(chTable[ce], x) + } + else if \(L := chTable[x][ce]) then + ::put(L, chnl := ::condvar([])) else { - L := [] + L := [] ::put(L, chnl := ::condvar([])) chTable[x][ce] := L - } + } } # critical return chnl } @@ -93,18 +93,18 @@ procedure channel(x, port) if not(::member(chTableP, ce)) then chTableP[ce] := ::table() if not(::member(chTableP, x)) then chTableP[x] := ::table() - if \(TP := chTableP[ce][x]) & \(chnl := TP[port]) then { - ::delete(TP, port) - if *TP=0 then ::delete(chTableP[ce], x) - } - else if \(TP := chTableP[x][ce]) then { - TP[port] := chnl := ::condvar([]) + if \(TP := chTableP[ce][x]) & \(chnl := TP[port]) then { + ::delete(TP, port) + if *TP=0 then ::delete(chTableP[ce], x) + } + else if \(TP := chTableP[x][ce]) then { + TP[port] := chnl := ::condvar([]) } else { - TP := ::table() + TP := ::table() TP[port] := chnl := ::condvar([]) chTableP[x][ce] := TP - } + } } # critical return chnl } @@ -140,17 +140,17 @@ initially(work, t) end class Task( - nthread, # number of threads asked for - active_threads, # the threads assigned to this task - func, # proc, what I'm supposed to do - reduce_func, # proc, how do I combine results - tttype, # thread task type , repeat, divide, chunk - chunk_size, # + nthread, # number of threads asked for + active_threads, # the threads assigned to this task + func, # proc, what I'm supposed to do + reduce_func, # proc, how do I combine results + tttype, # thread task type , repeat, divide, chunk + chunk_size, # caller, - cv_caller, # + cv_caller, # args, result_list, - done # set when done + done # set when done ) method do_work(args) @@ -164,7 +164,7 @@ class Task( ::insert(active_threads, ¤t) if \func then { if rslt := func(args) then done := "Yes" - } + } else if rslt := do_work(args) then done := "yes" ::delete(active_threads, ¤t) ::put(result_list, rslt) @@ -273,15 +273,15 @@ method thread_func() ::insert(thread_active,cur_thread) #write("thread is execing task") - if rslt_lst := tsk.exec_map() then - ::put(tsk.result_list, tsk.reduce_func(rslt_lst)) + if rslt_lst := tsk.exec_map() then + ::put(tsk.result_list, tsk.reduce_func(rslt_lst)) #write("thread done execing task") ::delete(thread_active, cur_thread) ::insert(thread_ready, cur_thread) critical task_ready: { - if *tsk.args>0 & tsk~===task_ready[1] then + if *tsk.args>0 & tsk~===task_ready[1] then ::push(task_ready, tsk) } diff --git a/uni/lib/threadh.icn b/uni/lib/threadh.icn index c28cb742d..4a1e273af 100644 --- a/uni/lib/threadh.icn +++ b/uni/lib/threadh.icn @@ -4,24 +4,24 @@ # June/15/2012 # -$define OFF 0 -$define ON 1 +$define OFF 0 +$define ON 1 -$define INBOX 1000 -$define OUTBOX 1001 -$define INBOX_SIZE 1002 -$define OUTBOX_SIZE 1003 -$define INBOX_LIMIT 1004 -$define OUTBOX_LIMIT 1005 -$define INBOX_CV_FULL 1006 -$define INBOX_CV_EMPTY 1007 -$define OUTBOX_CV_FULL 1008 -$define OUTBOX_CV_EMPTY 1009 +$define INBOX 1000 +$define OUTBOX 1001 +$define INBOX_SIZE 1002 +$define OUTBOX_SIZE 1003 +$define INBOX_LIMIT 1004 +$define OUTBOX_LIMIT 1005 +$define INBOX_CV_FULL 1006 +$define INBOX_CV_EMPTY 1007 +$define OUTBOX_CV_FULL 1008 +$define OUTBOX_CV_EMPTY 1009 -$define CHANNEL_SIZE 1010 -$define CHANNEL_LIMIT 1011 +$define CHANNEL_SIZE 1010 +$define CHANNEL_LIMIT 1011 -$define MUTEX 1050 -$define CV 1051 -$define CV_FULL 1052 -$define CV_EMPTY 1053 +$define MUTEX 1050 +$define CV 1051 +$define CV_FULL 1052 +$define CV_EMPTY 1053 diff --git a/uni/lib/time.icn b/uni/lib/time.icn index 9582b61ec..8232d6017 100644 --- a/uni/lib/time.icn +++ b/uni/lib/time.icn @@ -42,7 +42,7 @@ global Time_data_months, Time_data_base_year, Time_data_week_days, # @ t.set_seconds(n, z) # n seconds past the base date in GMT, +/-z mins # class Time : Error : Object(seconds, year, month, mday, hour, min, sec, - zone, psub, ppos) + zone, psub, ppos) # # Convert to a string # @@ -57,9 +57,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, local s s := ::string(n) if *s < w then - return ::right(s, w, "0") + return ::right(s, w, "0") else - return s + return s end # @@ -69,9 +69,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, local s s := Time_data_week_days[self.week_day() + 1] if w < 4 then - return s[1:4] + return s[1:4] else - return s + return s end # @@ -81,13 +81,13 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, local s if w < 3 then - return format_int(self.month, w) + return format_int(self.month, w) s := Time_data_months[self.month] if w = 3 then - return s[1:4] + return s[1:4] else - return s + return s end # @@ -97,9 +97,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, local s if w == 2 then - return format_int(self.year % 100, w) + return format_int(self.year % 100, w) else - return format_int(self.year, w) + return format_int(self.year, w) end # @@ -162,44 +162,44 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, res := "" p ? { - while not ::pos(0) do { - if ::any('EydHMhmsaAz') then { - ch := p[&pos] - w := *::tab(::many(ch)) - res ||:= case ch of { - "E": format_weekday(w) - "y": format_year(w) - "M": format_month(w) - "d": format_int(self.mday, w) - "h": { - if self.hour < 13 then - format_int(self.hour, w) - else - format_int(self.hour - 12, w) - } - "H": format_int(self.hour, w) - "m": format_int(self.min, w) - "s": format_int(self.sec, w) - "z": zone.get_id() - "Z": zone.get_offset() - "a": { - if self.hour < 12 then - "am" - else - "pm" - } - "A": { - if self.hour < 12 then - "AM" - else - "PM" - } - } - } else if ::any('\'') then - res ||:= match_literal() - else - res ||:= ::move(1) - } + while not ::pos(0) do { + if ::any('EydHMhmsaAz') then { + ch := p[&pos] + w := *::tab(::many(ch)) + res ||:= case ch of { + "E": format_weekday(w) + "y": format_year(w) + "M": format_month(w) + "d": format_int(self.mday, w) + "h": { + if self.hour < 13 then + format_int(self.hour, w) + else + format_int(self.hour - 12, w) + } + "H": format_int(self.hour, w) + "m": format_int(self.min, w) + "s": format_int(self.sec, w) + "z": zone.get_id() + "Z": zone.get_offset() + "a": { + if self.hour < 12 then + "am" + else + "pm" + } + "A": { + if self.hour < 12 then + "AM" + else + "PM" + } + } + } else if ::any('\'') then + res ||:= match_literal() + else + res ||:= ::move(1) + } } return res end @@ -215,7 +215,7 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, # of this field. This allows for example yyyyMMdd to parse 20001201. # if ::any('ydHMhms') then - j >:= ppos + w + j >:= ppos + w n := ::integer(psub[ppos:j]) ppos := j @@ -276,13 +276,13 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, ="\'" s := "" repeat { - s ||:= ::tab(::find("\'") | 0) - if ::pos(0) then - break - ::move(1) - # Two ''s in a row mean a single ' and press on - else break. - s ||:= ="'" | break - } + s ||:= ::tab(::find("\'") | 0) + if ::pos(0) then + break + ::move(1) + # Two ''s in a row mean a single ' and press on - else break. + s ||:= ="'" | break + } return s end @@ -293,11 +293,11 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, local n n := parse_int(w) | fail if n < 70 then - return 2000 + n + return 2000 + n else if n < 100 then - return 1900 + n + return 1900 + n else - return n + return n end # @@ -350,33 +350,33 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, ch := p[&pos] w := *::tab(::many(ch)) case ch of { - "E": parse_weekday() | fail - "y": y := parse_year(w) | fail - "M": m := parse_month(w) | fail - "d": d := parse_int(w) | fail - "h"|"H": hh := parse_int(w) | fail - "m": mm := parse_int(w) | fail - "s": ss := parse_int(w) | fail - "z": z := parse_timezone() | fail - "A"|"a": { - ampm := parse_ampm() | fail - if ampm == "pm" & (0 < \hh < 12) then - hh +:= 12 - } - } - } - else if ::any('\'') then { - lit := match_literal() - ppos := ::match(lit, psub, ppos) | - return error("Expected literal:" || lit) - } - else { - ch := ::move(1) - while psub[ppos] == ch do - ppos +:= 1 - } - } - } + "E": parse_weekday() | fail + "y": y := parse_year(w) | fail + "M": m := parse_month(w) | fail + "d": d := parse_int(w) | fail + "h"|"H": hh := parse_int(w) | fail + "m": mm := parse_int(w) | fail + "s": ss := parse_int(w) | fail + "z": z := parse_timezone() | fail + "A"|"a": { + ampm := parse_ampm() | fail + if ampm == "pm" & (0 < \hh < 12) then + hh +:= 12 + } + } + } + else if ::any('\'') then { + lit := match_literal() + ppos := ::match(lit, psub, ppos) | + return error("Expected literal:" || lit) + } + else { + ch := ::move(1) + while psub[ppos] == ch do + ppos +:= 1 + } + } + } set_fields(y, m, d, hh, mm, ss, z) return end @@ -480,9 +480,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, self.min +:= self.sec / 60 self.sec %:= 60 if self.sec < 0 then { - self.sec +:= 60 - self.min -:= 1 - } + self.sec +:= 60 + self.min -:= 1 + } # # Normalize minutes @@ -490,9 +490,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, self.hour +:= self.min / 60 self.min %:= 60 if self.min < 0 then { - self.min +:= 60 - self.hour -:= 1 - } + self.min +:= 60 + self.hour -:= 1 + } # # Normalize hours @@ -500,9 +500,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, self.mday +:= self.hour / 24 self.hour %:= 24 if self.hour < 0 then { - self.hour +:= 24 - self.mday -:= 1 - } + self.hour +:= 24 + self.mday -:= 1 + } # # Normalize month, year @@ -512,7 +512,7 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, if self.month < 1 then { self.year -:= 1 self.month +:= 12 - } + } # # Normalize mday downwards, adjusting month, year as we go along @@ -521,10 +521,10 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, self.mday -:= n self.month +:= 1 if self.month = 13 then { - self.month := 1 - self.year +:= 1 - } - } + self.month := 1 + self.year +:= 1 + } + } # # Normalize mday upwards, adjusting month, year as we go along @@ -532,19 +532,19 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, while self.mday < 1 do { self.month -:= 1 if self.month = 0 then { - self.month := 12 - self.year -:= 1 - } - self.mday +:= get_days(self.year, self.month) - } + self.month := 12 + self.year -:= 1 + } + self.mday +:= get_days(self.year, self.month) + } year_diff := self.year - Time_data_base_year days := 365 * year_diff + (year_diff + 3) / 4 - (year_diff + 99) / 100 + - (year_diff + 399) / 400 + get_cum_days(year, month) + mday - 1 + (year_diff + 399) / 400 + get_cum_days(year, month) + mday - 1 return seconds := 86400 * days + 3600 * hour + 60 * min + sec - - zone.get_offset() + zone.get_offset() end # @@ -567,51 +567,51 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, # Case analysis within the 400 years to reduce to 4 years of 1460 or 1461 # days. - flag indicates whether block is 1460 or 1461 days if n < 36525 then { # 1/1/1600 - 31/12/1699 - 25 blocks of 1461 days - year +:= 4 * (n / 1461) - n %:= 1461 - flag := 1 - } + year +:= 4 * (n / 1461) + n %:= 1461 + flag := 1 + } else if n < 37985 then { # 1/1/1700 - 31/12/1703 - 1 block of 1460 days year +:= 100 n -:= 36525 - } + } else if n < 73049 then { # 1/1/1704 - 31/12/1799 - 24 blocks of 1461 days - n -:= 37985 - year +:= 104 + 4 * (n / 1461) - n %:= 1461 - flag := 1 - } + n -:= 37985 + year +:= 104 + 4 * (n / 1461) + n %:= 1461 + flag := 1 + } else if n < 74509 then { # 1/1/1800 - 31/12/1803 - 1 block of 1460 days - year +:= 200 - n -:= 73049 - } + year +:= 200 + n -:= 73049 + } else if n < 109573 then { # 1/1/1804 - 31/12/1899 - 24 blocks of 1461 days - n -:= 74509 - year +:= 204 + 4 * (n / 1461) - n %:= 1461 - flag := 1 - } + n -:= 74509 + year +:= 204 + 4 * (n / 1461) + n %:= 1461 + flag := 1 + } else if n < 111033 then { # 1/1/1900 - 31/12/1903 - 1 block of 1460 days - year +:= 300 - n -:= 109573 - } + year +:= 300 + n -:= 109573 + } else { # n < 146097 1/1/1904 - 31/12/1999 - 24 blocks of 1461 days - n -:= 111033 - year +:= 304 + 4 * (n / 1461) - n %:= 1461 - flag := 1 - } + n -:= 111033 + year +:= 304 + 4 * (n / 1461) + n %:= 1461 + flag := 1 + } if /flag then { # 4 years of 365 days each - year +:= n / 365 - n %:= 365 - } + year +:= n / 365 + n %:= 365 + } else { # 4 years of 366, 365, 365, 365 days - if n > 365 then { - year +:= 1 + (n - 366) / 365 - n := (n - 366) % 365 - } - } + if n > 365 then { + year +:= 1 + (n - 366) / 365 + n := (n - 366) % 365 + } + } self.year := year get_cum_days(self.year, i := 1 to 13) > n @@ -767,9 +767,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, # # @p method get_cum_days(y, m) - return if (y % 4 = 0) & (y % 100 ~= 0 | y % 400 = 0) then # leap year + return if (y % 4 = 0) & (y % 100 ~= 0 | y % 400 = 0) then # leap year [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366][m] - else # non-leap year + else # non-leap year [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365][m] end @@ -778,9 +778,9 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, # # @p method get_days(y, m) - return if (y % 4 = 0) & (y % 100 ~= 0 | y % 400 = 0) then # leap year + return if (y % 4 = 0) & (y % 100 ~= 0 | y % 400 = 0) then # leap year [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m] - else # non-leap year + else # non-leap year [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m] end @@ -812,7 +812,7 @@ class Time : Error : Object(seconds, year, month, mday, hour, min, sec, ss := get_int() | 0 if ::tab(::upto(Time_data_tzchars)) then z := get_known_timezone(::tab(::many(Time_data_tzchars))) | - return error("No timezone") + return error("No timezone") else z := get_system_timezone() } @@ -881,7 +881,7 @@ procedure init_time() "June", "July", "August", "September", "October", "November", "December"] Time_data_week_days := ["Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday", "Sunday"] + "Thursday", "Friday", "Saturday", "Sunday"] Time_data_tzchars := '+-' ++ &digits ++ &ucase Time_data_base_year := 1600 # must be a multiple of 400 Time_data_unix_base_offset := 11676096000 diff --git a/uni/lib/timezone.icn b/uni/lib/timezone.icn index af66682bd..2237eea55 100644 --- a/uni/lib/timezone.icn +++ b/uni/lib/timezone.icn @@ -22,29 +22,29 @@ class Timezone(offset, id) initially(a[]) static once if /once then { - init_timezone() - once := 1 - } + init_timezone() + once := 1 + } if *a = 0 then { - id := "UTC" - offset := 0 - } + id := "UTC" + offset := 0 + } else if *a = 1 then { - if ::type(a[1]) == "integer" then { - offset := a[1] - id := (if offset < 0 then "-" else "+") || - ::right(::abs(offset) / 3600, 2, "0") || - ::right((::abs(offset) % 3600) / 60, 2, "0") - } - else { - id := a[1] - offset := get_known_timezone(id).get_offset() | fail - } - } + if ::type(a[1]) == "integer" then { + offset := a[1] + id := (if offset < 0 then "-" else "+") || + ::right(::abs(offset) / 3600, 2, "0") || + ::right((::abs(offset) % 3600) / 60, 2, "0") + } + else { + id := a[1] + offset := get_known_timezone(id).get_offset() | fail + } + } else { - offset := a[1] - id := a[2] - } + offset := a[1] + id := a[2] + } end procedure init_timezone() @@ -78,12 +78,12 @@ procedure init_timezone() # If possible, use a symbolic representation, eg "EST" instead of -0500 if &features == "UNIX" then { if f := ::open("date +%Z", "p") then { - t := ::read(f) - ::close(f) - } + t := ::read(f) + ::close(f) + } # Only use a known symbol whose offset agrees with the one just calculated if (\known_timezones[\t]).get_offset() = system_timezone.get_offset() then - system_timezone := known_timezones[t] + system_timezone := known_timezones[t] } end @@ -114,14 +114,14 @@ procedure get_known_timezone(id) id ? { if ::any('+-') then { - if ::any('-') then - sign := -1 - else - sign := 1 - ::move(1) - s := ::tab(::many(&digits)) | fail - return Timezone(sign * 3600 * ::integer(s[1:3]) + 60 * ::integer(s[3:5]), - id) | fail - } + if ::any('-') then + sign := -1 + else + sign := 1 + ::move(1) + s := ::tab(::many(&digits)) | fail + return Timezone(sign * 3600 * ::integer(s[1:3]) + 60 * ::integer(s[3:5]), + id) | fail + } } end diff --git a/uni/lib/union.icn b/uni/lib/union.icn index 8727cdd68..93f3ae319 100644 --- a/uni/lib/union.icn +++ b/uni/lib/union.icn @@ -555,7 +555,7 @@ procedure parse_record(token, token_gen, parse_funcs, refs, uerror) local rName, union_object, union_key, union_value, prev_token, tok, r ref := @token_gen rName := (@token_gen)[2:-1] # skips ":" and strips quotes - if not ::proc(rName) then { # No constructor in this context + if not ::proc(rName) then { # No constructor in this context uerror.set_err("No constructor for record '"||rName||" in this context.") fail } @@ -635,7 +635,7 @@ procedure parse_class(token, token_gen, parse_funcs, refs, uerror) local ref ref := @token_gen cName := (@token_gen)[2:-1] # skips ":" and strips quotes - if not ::proc(cName) then { # No constructor in this context + if not ::proc(cName) then { # No constructor in this context uerror.set_err("No constructor for class '"||cName||" in this context.") fail } diff --git a/uni/lib/url.icn b/uni/lib/url.icn index 3cbedd07e..5a61ffb95 100644 --- a/uni/lib/url.icn +++ b/uni/lib/url.icn @@ -17,7 +17,7 @@ $include "posix.icn" # This class encapsulates a URL # class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, - port, file_handle, header) + port, file_handle, header) method get_template() return ["protocol", "address", "file", "ref", "port", "header"] end @@ -125,19 +125,19 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, cgi := ::table() self.file ? { - if ::tab(::find("?")) then { - ::move(1) - while not ::pos(0) do { - key := ::tab(::upto('&=') | 0) - if ="=" then - val := extract_hex(::tab(::find("&") | 0)) - else - val := "" - ="&" - /cgi[key] := [] - ::put(cgi[key], val) - } - } + if ::tab(::find("?")) then { + ::move(1) + while not ::pos(0) do { + key := ::tab(::upto('&=') | 0) + if ="=" then + val := extract_hex(::tab(::find("&") | 0)) + else + val := "" + ="&" + /cgi[key] := [] + ::put(cgi[key], val) + } + } } return cgi end @@ -158,11 +158,11 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, local l, s s := "" every l := !::sort(cgi) do { - if ::string(l[2]) then - s ||:= convert_hex(l[1]) || "=" || convert_hex(l[2]) || "&" - else - every s ||:= convert_hex(l[1]) || "=" || convert_hex(!l[2]) || "&" - } + if ::string(l[2]) then + s ||:= convert_hex(l[1]) || "=" || convert_hex(l[2]) || "&" + else + every s ||:= convert_hex(l[1]) || "=" || convert_hex(!l[2]) || "&" + } s[-1] := "" return s end @@ -174,15 +174,15 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, local res static convert_chars initial - convert_chars := &lcase ++ &ucase ++ &digits ++ '_*.- ' + convert_chars := &lcase ++ &ucase ++ &digits ++ '_*.- ' res := "" s ? repeat { - res ||:= ::tab(::many(convert_chars)) - if ::pos(0) then - break - res ||:= "%" || format_int_to_string(::ord(::move(1)),,2) - } + res ||:= ::tab(::many(convert_chars)) + if ::pos(0) then + break + res ||:= "%" || format_int_to_string(::ord(::move(1)),,2) + } res := ::map(res, " ", "+") return res end @@ -195,12 +195,12 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, res := "" s := ::map(s, "+", " ") s ? repeat { - res ||:= ::tab(::find("%") | 0) - if ::pos(0) then - break - ::move(1) - res ||:= ::char(format_string_to_int(::move(2))) - } + res ||:= ::tab(::find("%") | 0) + if ::pos(0) then + break + ::move(1) + res ||:= ::char(format_string_to_int(::move(2))) + } return res end @@ -209,26 +209,26 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, # method parse(s) s ? { - set_protocol(1(::tab(::many(&letters)), ="://") | "http") - set_address(::tab(::upto(':/') | 0)) - - if =":" then { - set_port(::integer(::tab(::many(&digits)))) | return error("Bad port") - } - else - set_port(getserv(get_protocol() | "www").port) | - return error("Unknown protocol") - - if ::pos(0) then - set_file("/") - else { - ::any('/') | fail - set_file(::tab(::find("#") | 0)) - if ::any('#') then { - ::move(1) - set_ref(::tab(0)) - } - } + set_protocol(1(::tab(::many(&letters)), ="://") | "http") + set_address(::tab(::upto(':/') | 0)) + + if =":" then { + set_port(::integer(::tab(::many(&digits)))) | return error("Bad port") + } + else + set_port(getserv(get_protocol() | "www").port) | + return error("Unknown protocol") + + if ::pos(0) then + set_file("/") + else { + ::any('/') | fail + set_file(::tab(::find("#") | 0)) + if ::any('#') then { + ::move(1) + set_ref(::tab(0)) + } + } } return end @@ -240,27 +240,27 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, # method set_relative(s) if s[1] == "#" then - # - # Just reference, filename doesn't change. - # - set_ref(s[2:0]) + # + # Just reference, filename doesn't change. + # + set_ref(s[2:0]) else { - # - # File name and possibly reference. First check whether - # relative to current directory. - # - if s[1] ~== "/" then - s := get_file_dir() || s - - s ? { - set_file(::tab(::find("#") | 0)) - if ="#" then { - set_ref(::tab(0)) - } - else - set_ref() - } - } + # + # File name and possibly reference. First check whether + # relative to current directory. + # + if s[1] ~== "/" then + s := get_file_dir() || s + + s ? { + set_file(::tab(::find("#") | 0)) + if ="#" then { + set_ref(::tab(0)) + } + else + set_ref() + } + } end # @@ -268,9 +268,9 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, # method get_file_last() file ? { - while ::tab(::find("/")+1) - return ::tab(0) - } + while ::tab(::find("/")+1) + return ::tab(0) + } end # @@ -278,12 +278,12 @@ class URL : Error : Object : SelectiveClassCoding(protocol, address, file, ref, # method get_file_dir() file ? { - while ::tab(::find("/")+1) - return ::tab(1) - } + while ::tab(::find("/")+1) + return ::tab(1) + } end initially(a[]) if *a = 1 then - parse(a[1]) | fail + parse(a[1]) | fail end diff --git a/uni/lib/vgamem.icn b/uni/lib/vgamem.icn index 827456901..980ab5542 100644 --- a/uni/lib/vgamem.icn +++ b/uni/lib/vgamem.icn @@ -14,31 +14,31 @@ $ifdef _UNIX pin := open("/sbin/lspci -v", "p") | stop("can't run /sbin/lspci") while line := read(pin) do { line ? { - if any(&digits) & find("VGA") then { - mem := 0 - while line := read(pin) do { - if line == "" then break - line ? { - tab(many(' \t')) - if ="Memory at" then { - tab(many(' \t')) | next - tab(many(&digits ++ 'abcdefABCDEF')) | next - tab(many(' \t')) | next - ="(" | next - tab(many(&digits)) | next - ="-bit," | next - tab(many(' \t')) | next - ="prefetchable" | next - =")" | next - tab(many(' \t')) | next - ="[" | next - ="size=" | next - mem <:= KMsize(tab(many(&digits++'KM'))) - } - } - } - put(results, 0 < mem) - } + if any(&digits) & find("VGA") then { + mem := 0 + while line := read(pin) do { + if line == "" then break + line ? { + tab(many(' \t')) + if ="Memory at" then { + tab(many(' \t')) | next + tab(many(&digits ++ 'abcdefABCDEF')) | next + tab(many(' \t')) | next + ="(" | next + tab(many(&digits)) | next + ="-bit," | next + tab(many(' \t')) | next + ="prefetchable" | next + =")" | next + tab(many(' \t')) | next + ="[" | next + ="size=" | next + mem <:= KMsize(tab(many(&digits++'KM'))) + } + } + } + put(results, 0 < mem) + } } } close(pin) @@ -58,14 +58,14 @@ $ifdef _MS_WINDOWS_NT } while line := read(fin) do { line ? { - # Look for "Adapter RAM" - in MSinfo32's Unicode output + # Look for "Adapter RAM" - in MSinfo32's Unicode output if tab(find("A\0d\0a\0p\0t\0e\0r\0 \0R\0A\0M\0")) then { - tab(find("(")+2) | fail - mem := 0 - while c := move(1) do { mem := mem * 10 + integer(c); move(1) } - close(fin) - remove(fn) - return mem + tab(find("(")+2) | fail + mem := 0 + while c := move(1) do { mem := mem * 10 + integer(c); move(1) } + close(fin) + remove(fn) + return mem } } } @@ -78,8 +78,8 @@ end # procedure KMsize(s) case s[-1] of { - "M": return integer(s[1:-1]) * 1024 * 1024 - "K": return integer(s[1:-1]) * 1024 - default: return s + "M": return integer(s[1:-1]) * 1024 * 1024 + "K": return integer(s[1:-1]) * 1024 + default: return s } end diff --git a/uni/lib/webup.icn b/uni/lib/webup.icn index 2d40e47b2..109ae76fd 100644 --- a/uni/lib/webup.icn +++ b/uni/lib/webup.icn @@ -1,12 +1,12 @@ ############################################################################ # -# File: webup.icn +# File: webup.icn # -# Subject: A rudimentary web-based updater/patcher. +# Subject: A rudimentary web-based updater/patcher. # -# Author: Clint Jeffery +# Author: Clint Jeffery # -# Date: 30 June 2010 +# Date: 30 June 2010 # ############################################################################ # @@ -53,46 +53,46 @@ class dialogtable() platform := $ifdef _UNIX - "linux" + "linux" $else - "windows" + "windows" $endif N := 0 every dir := (platform | "shared") do { - d.syncdir := dir + d.syncdir := dir - if *(L := d.check()) > 0 then { - N +:= *L - handle_updates(L, d) - } - } + if *(L := d.check()) > 0 then { + N +:= *L + handle_updates(L, d) + } + } if N = 0 then { - d.message("no files updated") - delay(500) - d.dispose() - } + d.message("no files updated") + delay(500) + d.dispose() + } else { - d.message((N/3) || " files updated") - delay(3500) - d.dispose() - } + d.message((N/3) || " files updated") + delay(3500) + d.dispose() + } end method handle_updates(L, d) local fn, reason, size, errs, nerrs - errs := "" + errs := "" nerrs := 0 while fn := pop(L) do { - reason := pop(L) - size := pop(L) - errs ||:= d.update(fn, reason, size) || " " - } + reason := pop(L) + size := pop(L) + errs ||:= d.update(fn, reason, size) || " " + } if errs ~== "" then { - d.message("exiting because: " || errs) - dispatcher.message_loop(d) - exit(-1) - } + d.message("exiting because: " || errs) + dispatcher.message_loop(d) + exit(-1) + } d.message("updated " || fn || ", continuing") delay(800) return @@ -157,7 +157,7 @@ class UnicronProgressBar : _Dialog(lab, fnlab, pb, closebtn, syncdir) closebtn: { if ev.get_code() > 0 then { dispose() - win := &null + win := &null } } } @@ -175,39 +175,39 @@ class UnicronProgressBar : _Dialog(lab, fnlab, pb, closebtn, syncdir) message("checking "|| url|| "...") db := open(url, "m") | { write("can't update, was trying to read ", image(url)) - fail + fail } message("checking... opened " || url) L := [] while r := read(db) do { - if (r == "") | (r[1] == "#") | match("filename ",r) then next - r ? { + if (r == "") | (r[1] == "#") | match("filename ",r) then next + r ? { filen := tab(upto(' \t'))|write("no filename in ", image(r)) tab(many(' \t')) size := numeric(tab(many(&digits)))| - write("no filesize in ", image(r)) + write("no filesize in ", image(r)) tab(many(' \t')) mtime := numeric(tab(many(&digits)))| - write("no mtime in ", image(r)) - } + write("no mtime in ", image(r)) + } message("checking " || filen) if not (fs := stat(filen)) then { put(L, filen, "because it is a new file", size) } else if fs.size ~= size then { put(L, filen, "because its size ("||size|| - ") is different than ours (" || fs.size||")", size) + ") is different than ours (" || fs.size||")", size) } else if fs.mtime < mtime then { put(L, filen, "because it is newer ("||mtime|| - ") than ours (" || fs.mtime || ")", size) + ") than ours (" || fs.mtime || ")", size) + } + else { + #write("don't think we updated ", filen) + #write("\tbecause ", image(fs.size), " = ", image(size)) + #write("\tbecause ", image(fs.mtime), " >= ", image(mtime)) + } } - else { - #write("don't think we updated ", filen) - #write("\tbecause ", image(fs.size), " = ", image(size)) - #write("\tbecause ", image(fs.mtime), " >= ", image(mtime)) - } - } close(db) return L end @@ -223,7 +223,7 @@ class UnicronProgressBar : _Dialog(lab, fnlab, pb, closebtn, syncdir) pb.set_percentage(0) (fetcher := open(distfile(fn), "m")) | { s := "can't get contents of " || fn - message(s) + message(s) WAttrib(win, "pointer=arrow") return s } @@ -239,11 +239,11 @@ class UnicronProgressBar : _Dialog(lab, fnlab, pb, closebtn, syncdir) } total := 0 while writes(fo, s := reads(fetcher, 1024)) do { - total +:= *s - percent := 100 * total / size - if percent > 100 then percent := 100 - pb.set_percentage(percent) - } + total +:= *s + percent := 100 * total / size + if percent > 100 then percent := 100 + pb.set_percentage(percent) + } close(fo) if match("new-", fn) then { s := "couldn't write " || fn[4:0] || @@ -264,18 +264,18 @@ initially local t self$_Dialog.initially() set_attribs("label=" || webuptitle, "size=644,399", - "font=sans", "bg=yellowish white", "resize=on") + "font=sans", "bg=yellowish white", "resize=on") t := Label("pos=10%,15%", "size=80%,10%", - "internal_alignment=c", - "label=Checking for update files! please wait...") + "internal_alignment=c", + "label=Checking for update files! please wait...") t.set_attribs("font=serif,28,bold","fg=blue") add(t) lab := Label("pos=50%,80%", "size=90%,10%", "align=c,c", - "label=initializing...") + "label=initializing...") lab.set_attribs("font=serif,18,bold") add(lab) fnlab := Label("pos=50%,38%", "size=50%,15%", "align=c,c", - "label=no files updated") + "label=no files updated") fnlab.set_attribs("font=serif,18,bold") add(fnlab) pb := ProgressBar("pos=50%,50%", "size=50%", "align=c,c") From 471f810b7d4bd2ab5314418b57ff595bec58d1e5 Mon Sep 17 00:00:00 2001 From: Don Ward Date: Sun, 10 Mar 2024 14:12:20 +0000 Subject: [PATCH 5/7] Convert tabs to spaces (uni/progs). --- uni/progs/bored.icn | 56 ++++----- uni/progs/cleanup.icn | 28 ++--- uni/progs/deen.icn | 158 +++++++++++------------ uni/progs/htmltex.icn | 252 ++++++++++++++++++------------------- uni/progs/ie.icn | 40 +++--- uni/progs/jsvalid.icn | 12 +- uni/progs/mtrace.icn | 22 ++-- uni/progs/uget.icn | 88 ++++++------- uni/progs/umake.icn | 282 +++++++++++++++++++++--------------------- uni/progs/uprof.icn | 144 ++++++++++----------- uni/progs/ush.icn | 206 +++++++++++++++--------------- uni/progs/uwc.icn | 12 +- 12 files changed, 650 insertions(+), 650 deletions(-) diff --git a/uni/progs/bored.icn b/uni/progs/bored.icn index 11ac1cdf9..b6693b0d2 100755 --- a/uni/progs/bored.icn +++ b/uni/progs/bored.icn @@ -43,16 +43,16 @@ # the Master's hints and try to make a better guess based on that. # # Update (Feb 10, 2011) -# Add new threads that help the master evaluate the guesses. +# Add new threads that help the master evaluate the guesses. # class MsgData( - gs, # the thread guess - mtx_gs, # mutex to protect gs - rp, # the master reply - mtx_rp # mutex to protect rp + gs, # the thread guess + mtx_gs, # mutex to protect gs + rp, # the master reply + mtx_rp # mutex to protect rp ) - + # post a msg from a thread to the master method send_guess(g) lock(mtx_gs) @@ -95,23 +95,23 @@ class MsgData( end global msgs, # list that hold msgs between the threads and the master - # msg[1] : master and thread 1 - # msg[2] : master and thread 2 - # and so forth... - + # msg[1] : master and thread 1 + # msg[2] : master and thread 2 + # and so forth... + go, # flags the begining of the competetion between the threads Max, # the max guess done, - N - -procedure main(argv) + N + +procedure main(argv) local n:=3, threads:=[], answer, ways, names, guesses if not (&features == "concurrent threads") then stop("This program requires concurrent threads.") write("Expect variations in bored output:") - + ways:=[trust, notrust, doubt] names := ["Trust", "Notrust", "Doubt"] N := n @@ -125,8 +125,8 @@ procedure main(argv) put(guesses, GuessData(Max/2, 1, Max)) } - write(" Master: I have a number in mind between 1 and ", - Max ," (^o^)''{", answer ,"} ...") + write(" Master: I have a number in mind between 1 and ", + Max ," (^o^)''{", answer ,"} ...") write(" Can you threads guess what is it ?") write("Threads are trying ....") write(repl("-",80)) @@ -140,7 +140,7 @@ procedure main(argv) t:=&now go:=1 - + every wait(!threads) write(repl("-",80)) write("time:", &now-t, " seconds") @@ -149,14 +149,14 @@ end procedure process_guesses(id, answer, msg) local r while /done do{ - if g:=msg.get_guess() then{ - if g=answer then { msg.send_reply("="); break;} - r := if g" - ?2=1 | (r:= ?2("<",">")) # 50% chance to "alter" the answer - msg.send_reply(r) - } - else - delay(1) + if g:=msg.get_guess() then{ + if g=answer then { msg.send_reply("="); break;} + r := if g" + ?2=1 | (r:= ?2("<",">")) # 50% chance to "alter" the answer + msg.send_reply(r) + } + else + delay(1) } end @@ -202,7 +202,7 @@ class GuessData(gs, lo, hi, GS, LO, HI) else gs:=hi return gs end - + initially GS:=gs LO:=lo @@ -219,7 +219,7 @@ procedure work(id, msg, my_way, name, guess) i+:=1 msg.send_guess(guess.get()) if r:=msg.get_reply() then - if r=="=" then (done:=id)& break else guess.gs := my_way(guess, r) + if r=="=" then (done:=id)& break else guess.gs := my_way(guess, r) } write(name,"\t\t",i,"\t\t",guess.get(), "\t\t\t", if (\r)=="=" then "YES!" else "NO") end @@ -237,7 +237,7 @@ procedure trust(guess, r) if last=guess.get() then return guess.reset() - + return last:=guess.get() end diff --git a/uni/progs/cleanup.icn b/uni/progs/cleanup.icn index 4dab53e72..fc5c5a976 100644 --- a/uni/progs/cleanup.icn +++ b/uni/progs/cleanup.icn @@ -1,21 +1,21 @@ ############################################################################ # -# Name: cleanup.icn +# Name: cleanup.icn # -# Subject: Program to recurse down a directory hierarchy -# and remove files with # or ~ in their names +# Subject: Program to recurse down a directory hierarchy +# and remove files with # or ~ in their names # -# Author: Shea Newton and Clinton Jeffery, from Rosetta Code directory -# traversal solution at: -# http://rosettacode.org/wiki/Walk_a_directory/Recursively#Unicon +# Author: Shea Newton and Clinton Jeffery, from Rosetta Code directory +# traversal solution at: +# http://rosettacode.org/wiki/Walk_a_directory/Recursively#Unicon # -# Date: May 28, 2013 +# Date: May 28, 2013 # ############################################################################ $ifdef _MS_WINDOWS_NT $define RM "del /Q " -$define SL "\\" +$define SL "\\" $else $define RM "rm -f " $define SL "/" @@ -25,17 +25,17 @@ procedure main(argv) if *argv=0 then put(argv, ".") # writes out all directories from the current directory down every d := !getdirs(!argv) do { - + # construct file deletion commands around current directory name - # tilde's behaviour on Windows systems requires two separate expressions + # tilde's behaviour on Windows systems requires two separate expressions cmd1 := RM || d || SL || "*~" cmd2 := RM || d || SL || "\~*" cmd3 := RM || d || SL || "*\#*" $ifdef _MS_WINDOWS_NT - + # postpend Windows file deletion commands with stdout/stderr redirects. - # sends stderr to nul so user doesn't see complaints when files + # sends stderr to nul so user doesn't see complaints when files # matching these patterns aren't present cmd1 ||:= " >nul 2>&1" cmd2 ||:= " >nul 2>&1" @@ -58,7 +58,7 @@ procedure getdirs(s) # return a list of directories beneath the directory 's' D |||:= getdirs(s || SL || f) } close(d) - + return D - } + } end diff --git a/uni/progs/deen.icn b/uni/progs/deen.icn index 554bf53d9..af5660f82 100644 --- a/uni/progs/deen.icn +++ b/uni/progs/deen.icn @@ -9,10 +9,10 @@ procedure main(av) dd := DeenDictionary() every s := !av do { if lu := dd.lookup(s) then { - if \all then - every write(s, ": ", dd.lookup(s).definition) - else write(s, ": ", lu.definition) - } + if \all then + every write(s, ": ", dd.lookup(s).definition) + else write(s, ": ", lu.definition) + } else write(s, " is not in the dictionary.") } end @@ -25,15 +25,15 @@ class buffer(filename, text) f := open(filename, mode) | stop("can't open ", image(filename)) if filename[-3:0] == ".gz" then { - if mode=="m" then { # download_to_local_file - if not (f2 := open("de-en.txt.gz","w")) then stop("can't write") - while s := reads(f, 1000000) do writes(f2, s) - close(f) - close(f2) - } - system("gunzip de-en.txt.gz") - f := open("de-en.txt") | stop("can't read de-en.txt") - } + if mode=="m" then { # download_to_local_file + if not (f2 := open("de-en.txt.gz","w")) then stop("can't write") + while s := reads(f, 1000000) do writes(f2, s) + close(f) + close(f2) + } + system("gunzip de-en.txt.gz") + f := open("de-en.txt") | stop("can't read de-en.txt") + } writes("Opened ",image(f),".\nReading") text := [ ] @@ -55,11 +55,11 @@ class buftable : buffer() self.buffer.read() tmp := table() every line := !text do { - line ? { - word := tab(many(&letters)) | stop("failed on ", image(line)) - tmp[word] := line - } - } + line ? { + word := tab(many(&letters)) | stop("failed on ", image(line)) + tmp[word] := line + } + } text := tmp return end @@ -73,14 +73,14 @@ class dictionaryentry(word, part, etymology, definition) # assumed format is word;pos;eym;def method decode(s) s ? { - word := tab(find(";")) - move(1) - part := tab(find(";")) - move(1) - etymology := tab(find(";")) - move(1) - definition := tab(0) - } + word := tab(find(";")) + move(1) + part := tab(find(";")) + move(1) + etymology := tab(find(";")) + move(1) + definition := tab(0) + } end method encode() # encode a dictionary entry into a string return word || ";" || part || ";" || etymology || ";" || definition @@ -95,10 +95,10 @@ class dictionary : buftable() self.buffer.read() tmp := table() every line := !text do - line ? { - word := tab(many(&letters)) | stop("failed on ", image(line)) - tmp[word] := dictionaryentry(line) | fail - } + line ? { + word := tab(many(&letters)) | stop("failed on ", image(line)) + tmp[word] := dictionaryentry(line) | fail + } text := tmp end method Write() @@ -116,13 +116,13 @@ initially(de, en) de ? { if word := trim(tab(find("{")),,0) then { - ="{" - gender := tab(find("}")) - } + ="{" + gender := tab(find("}")) + } else { # here is one without gender info - word := trim(tab(find("[")|0),,0) - gender := "?" - } + word := trim(tab(find("[")|0),,0) + gender := "?" + } } definition := en end @@ -138,41 +138,41 @@ procedure get_entries(s) english := tab(0) deutsch ? { - while *(deutschwort := tab(find("|") | 0))>0 do { - deutschwort := trim(deutschwort,,0) - ="|" - tab(many(' ')) - englishword := trim(english[1:find("|",english)|0],,0) - english ?:= { - tab(many(' \t')) - =englishword - tab(many(' \t')) - ="|" - tab(many(' \t')) - tab(0) - } - if i := find(";", deutschwort) then { - deutschwort ? { - while *(dword := tab(find(";") | 0))>0 do { - =";" - tab(many(' ')) - if gronk:=englishword[1:upto(';|', englishword)|0] then { - if *gronk>0 then { - eword := gronk - } - } + while *(deutschwort := tab(find("|") | 0))>0 do { + deutschwort := trim(deutschwort,,0) + ="|" + tab(many(' ')) + englishword := trim(english[1:find("|",english)|0],,0) + english ?:= { + tab(many(' \t')) + =englishword + tab(many(' \t')) + ="|" + tab(many(' \t')) + tab(0) + } + if i := find(";", deutschwort) then { + deutschwort ? { + while *(dword := tab(find(";") | 0))>0 do { + =";" + tab(many(' ')) + if gronk:=englishword[1:upto(';|', englishword)|0] then { + if *gronk>0 then { + eword := gronk + } + } if /eword then stop("botched eword for dword ",image(dword)," in\n", s,"\n with remaining english of ", image(englishword)) if eword === "" then write("empty eword for ", dword, " in:\n", s) - put(subentries, DeenEntry(dword, eword)) - englishword ?:= { =eword; =";"; tab(many(' ')); tab(0)} - } - } - } - else { - put(subentries, DeenEntry(deutschwort, englishword)) - } - } - } + put(subentries, DeenEntry(dword, eword)) + englishword ?:= { =eword; =";"; tab(many(' ')); tab(0)} + } + } + } + else { + put(subentries, DeenEntry(deutschwort, englishword)) + } + } + } } return subentries end @@ -182,16 +182,16 @@ class DeenDictionary : dictionary() self.buffer.read() tmp := table() every line := !text do - line ? { - if ="#" | line=="" then next - if not (L := get_entries(line)) then - stop("get_entries failing on ", image(line)) - every x := !L do { - if not member(tmp, x.word) then - tmp[x.word] := [x] - else put(tmp[x.word], x) - } - } + line ? { + if ="#" | line=="" then next + if not (L := get_entries(line)) then + stop("get_entries failing on ", image(line)) + every x := !L do { + if not member(tmp, x.word) then + tmp[x.word] := [x] + else put(tmp[x.word], x) + } + } text := tmp end initially diff --git a/uni/progs/htmltex.icn b/uni/progs/htmltex.icn index f90604a15..ebec56d4a 100644 --- a/uni/progs/htmltex.icn +++ b/uni/progs/htmltex.icn @@ -1,12 +1,12 @@ ############################################################################ # -# File: htmltex.icn +# File: htmltex.icn # -# Subject: Program to convert LaTeX to HTML +# Subject: Program to convert LaTeX to HTML # -# Author: Clinton L. Jeffery +# Author: Clinton L. Jeffery # -# Date: February 18, 2015 +# Date: February 18, 2015 # ############################################################################ # @@ -39,39 +39,39 @@ procedure main(args) else { i := 1 while args[i][1] == "-" do { - case args[i] of { - "-silent": silent := 1 - "-cut" : cut := "-cut" - default : write(&errout,"dont know option ",args[i]) - } - i +:= 1 + case args[i] of { + "-silent": silent := 1 + "-cut" : cut := "-cut" + default : write(&errout,"dont know option ",args[i]) + } + i +:= 1 } if /silent then write(&errout, vers, " executed on ",date) if i > *args then { - every write(\ (htmltex(!&input))) - return + every write(\ (htmltex(!&input))) + return } if j := find(".ctex", args[i]) then { - args[i][j:0] := "" - system("retex -c -silent " || cut || " " || args[i]) + args[i][j:0] := "" + system("retex -c -silent " || cut || " " || args[i]) } else if j := find(".gtex", args[i]) then { - args[i][j:0] := "" - s := "pstex " || args[i] || ".gtex >" || args[i] || ".tex" - mysystem("rm -f " || args[i] || ".tex") - mysystem(s) - } + args[i][j:0] := "" + s := "pstex " || args[i] || ".gtex >" || args[i] || ".tex" + mysystem("rm -f " || args[i] || ".tex") + mysystem(s) + } else if j := find(".tex", args[i]) then args[i][j:0] := "" root := args[i] if not (fout := open(args[i] || ".html","w")) then - stop("htmltex: couldn't open ",args[i],".html for writing") + stop("htmltex: couldn't open ",args[i],".html for writing") include(args[i]) if \bibliography then { - if not (fin := open(bibliography,"r")) then - stop(&errout,"htmltex: couldn't open ",bibliography," for reading") - write(fout,"\n\n",trim(center("References",70))) - every write(fout,\ (debib(htmltex(!fin)))) - } + if not (fin := open(bibliography,"r")) then + stop(&errout,"htmltex: couldn't open ",bibliography," for reading") + write(fout,"\n\n",trim(center("References",70))) + every write(fout,\ (debib(htmltex(!fin)))) + } close(fout) } end @@ -264,7 +264,7 @@ while s[find("\\}", s) +: 2] := "\\rightcurly" if i := find("\\begin{supertabular}", s) then { in_supertabular := 1 s := "
" - + } if i := find("\\end{supertabular}", s) then { in_supertabular := &null @@ -284,9 +284,9 @@ while s[find("\\}", s) +: 2] := "\\rightcurly" else { # eat & in latex by default, but not if it is an HTML-ism while (x <- find("&",s)) & s[0$", s) +: 3] := ">" @@ -305,14 +305,14 @@ while s[find("\\}", s) +: 2] := "\\rightcurly" if i := find("\\hfill",s) then { s := "
" ||s[1:i]|| "
"|| - "
"||s[i+6:0]|| "
"|| - "
" + "
"||s[i+6:0]|| "
"|| + "
" } if i := find("\\hline",s) then { if \in_supertabular then - s[i +: *"\\hline"] := "\n" + s[i +: *"\\hline"] := "\n" else - s[i +: *"\\hline"] := "\n" || repl("-",i) || "\n" + s[i +: *"\\hline"] := "\n" || repl("-",i) || "\n" } while s[find("~",s)] := "" @@ -339,91 +339,91 @@ procedure deline(s) move(1) command := tab(many(&letters)) case command of { - "noindent": { - tab(many(' \t')) - return tab(0) - } - "caption": { - tab(upto('{')+1) - return "(Figure titled \"" || tab(-1) || "\" omitted.)" - } - "include": { - if ="{" & - (fname := tab(many(&letters++&digits))) & - ="}" then { - include(fname) - } - } - "item": { - tab(many(' \t')) - if ="[" then { - body := tab(upto(']')) - move(1) # past "]" - return body || tab(0) - } - else return "
  • " || tab(0) - } - "bibitem": { - body := tab(upto(']}')+1) - return body - } - "newblock": { - move(1) - body := tab(0) - return body - } - "bibliography": { - tab(upto('{')+1) - if not (body := tab(upto('}'))) then body := tab(0) - bibliography := (\root | body) || ".bbl" - return "" - } - "title": { - tab(upto('{')+1) - if not (body := tab(upto('}'))) then body := tab(0) - return "" || body || "" || "\n" || - "








    \n" || - "

    " || body || "

    " - } - "author": { - tab(upto('{')+1) - if not (body := tab(upto('}'))) then body := tab(0) - return "

    " || body || "
    \n" - } - "date": { - tab(upto('{')+1) # handle both \section{ and \section*{ - if not (body := tab(upto('}'))) then body := tab(0) - return body || "\n

    " - } - "section" | "subsection" | "subsubsection": { - tab(upto('{')+1) # handle both \section{ and \section*{ - if not (body := tab(upto('}'))) then body := tab(0) - return "<" || cmd2tag(command) || ">" || body || - "" - } - "iconcode": { - return "
    "
    -	    }
    -	 "trnumber": {
    -	    tab(upto('{')+1) # handle both \section{ and \section*{
    -	    if not (body := tab(upto('}'))) then body := tab(0)
    -	    return "TR " || body || "
    " - } - "abstract": { - return "




    \n

    _ + "noindent": { + tab(many(' \t')) + return tab(0) + } + "caption": { + tab(upto('{')+1) + return "(Figure titled \"" || tab(-1) || "\" omitted.)" + } + "include": { + if ="{" & + (fname := tab(many(&letters++&digits))) & + ="}" then { + include(fname) + } + } + "item": { + tab(many(' \t')) + if ="[" then { + body := tab(upto(']')) + move(1) # past "]" + return body || tab(0) + } + else return "
  • " || tab(0) + } + "bibitem": { + body := tab(upto(']}')+1) + return body + } + "newblock": { + move(1) + body := tab(0) + return body + } + "bibliography": { + tab(upto('{')+1) + if not (body := tab(upto('}'))) then body := tab(0) + bibliography := (\root | body) || ".bbl" + return "" + } + "title": { + tab(upto('{')+1) + if not (body := tab(upto('}'))) then body := tab(0) + return "" || body || "" || "\n" || + "








    \n" || + "

    " || body || "

    " + } + "author": { + tab(upto('{')+1) + if not (body := tab(upto('}'))) then body := tab(0) + return "

    " || body || "
    \n" + } + "date": { + tab(upto('{')+1) # handle both \section{ and \section*{ + if not (body := tab(upto('}'))) then body := tab(0) + return body || "\n

    " + } + "section" | "subsection" | "subsubsection": { + tab(upto('{')+1) # handle both \section{ and \section*{ + if not (body := tab(upto('}'))) then body := tab(0) + return "<" || cmd2tag(command) || ">" || body || + "" + } + "iconcode": { + return "
    "
    +            }
    +         "trnumber": {
    +            tab(upto('{')+1) # handle both \section{ and \section*{
    +            if not (body := tab(upto('}'))) then body := tab(0)
    +            return "TR " || body || "
    " + } + "abstract": { + return "




    \n

    _

    Abstract


    " - } - "maketitle": { - return "






    \n" || + } + "maketitle": { + return "






    \n" || "

    Department of Computer Science
    \n" || - "The University of Idaho
    \n" || - "Moscow, ID 83844\n

    \n
    " || - "(this document generated from latex source by " || vers || - ")




    \n" - } - default: { - return "" - } + "The University of Idaho
    \n" || + "Moscow, ID 83844\n

    \n
    " || + "(this document generated from latex source by " || vers || + ")




    \n" + } + default: { + return "" + } } } else @@ -440,23 +440,23 @@ procedure debrace(s) s ||:= " " while i := find((cmd := "{\\it "|"{\\em "|"{\\texttt "|"{\\tt "| - "{\\textbf "|"{\\bf "| "{\\textit "| - "{\\textsf "|"{\\sf "|"{\\ctt "|"{\\sf\\bf "),s) do { + "{\\textbf "|"{\\bf "| "{\\textit "| + "{\\textsf "|"{\\sf "|"{\\ctt "|"{\\sf\\bf "),s) do { j := &null k := 0 every j := bal(&cset,'{','}',s,i,0) \ 2 do k +:= 1 if \j & k=2 then { - s := s[1:i] || - "<" || cmd2tag(cmd) || ">" || - s[i+*cmd:j-1] || - "" || - s[j:0] + s := s[1:i] || + "<" || cmd2tag(cmd) || ">" || + s[i+*cmd:j-1] || + "" || + s[j:0] } else { - write(&errout,"check matching brace for ",image(s)) + write(&errout,"check matching brace for ",image(s)) write(&errout, " j ", image(j), " k ", image(k)) - break - } + break + } } while s[find("\\leftcurly", s) +: *"\\leftcurly"] := "{" while s[find("\\rightcurly", s) +: *"\\rightcurly"] := "}" diff --git a/uni/progs/ie.icn b/uni/progs/ie.icn index ce09eed4d..761ac4281 100644 --- a/uni/progs/ie.icn +++ b/uni/progs/ie.icn @@ -25,7 +25,7 @@ $endif else if a == "-w" then WinIcon :=1 } - + write("Icon Evaluator, Version 1.1, ? for help") if \NoNum then tag := create |"r" @@ -62,9 +62,9 @@ $endif writes(if *line = 0 then "][ " else "... ") inline := (read()|stop()) } - + inline := trim(inline, ' \t') - + if match(".type", inline) then { (/showtype := 1) | (showtype := &null) write("Will ",(/showtype&"not ")|"","display types") @@ -122,25 +122,25 @@ $endif #line[-2:0] := "" break } - else - line[-2:0] := "" + else + line[-2:0] := "" } - if \showtype then + if \showtype then put(extras, "showtype := 1") if match(".every ", line) then { every_exp := (line ? (=".every " & tab(0))) Generate := 1 } - + tfile := "._ie_tmp.icn" sfile := open(tfile,"w") | stop("Can't open ie tmp file (", tfile, ") for writing\n", "(Is the current directory writable?)") #sfile := open("icont -s - -x","pw") every write(sfile, !(header|||prog|||extras)) - + if \Generate then { write(sfile, "every WR(\"\",", every_exp, ")") curexp := "every (" || every_exp || ")" @@ -153,7 +153,7 @@ $endif if \WinIcon then write(sfile, "WDone()") - + write(sfile, "end") WriteWR(sfile) WriteSplit(sfile) @@ -168,7 +168,7 @@ $endif remove("._ie_tmp.icx") if \WinIcon then icont_cmd := "wicont" else icont_cmd := "nticont" - + rc := system(icont_cmd || " -s ._ie_tmp.icn " || atos(incfiles, " ")) if rc = 0 then @@ -198,16 +198,16 @@ end procedure WriteSplit(f) write(f, - "procedure split(line,dlms)\n", - "local w\n", - "/dlms := ' \t'\n", - "w := []\n", - "line ? repeat {\n", - " tab(upto(~dlms))\n", + "procedure split(line,dlms)\n", + "local w\n", + "/dlms := ' \t'\n", + "w := []\n", + "line ? repeat {\n", + " tab(upto(~dlms))\n", " put(w,tab(many(~dlms))) | break\n", " }\n", - "return w\n", - "end\n") + "return w\n", + "end\n") end procedure Help() @@ -228,7 +228,7 @@ procedure Edit(p) f := open("._ie_tmp.icn", "w") every write(f, !p) close(f) - + system("$EDITOR ._ie_tmp.icn") f := open("._ie_tmp.icn") @@ -237,7 +237,7 @@ procedure Edit(p) return p end - + procedure atos(a,delim) local e, s s := "" diff --git a/uni/progs/jsvalid.icn b/uni/progs/jsvalid.icn index 949cd0042..78af15180 100644 --- a/uni/progs/jsvalid.icn +++ b/uni/progs/jsvalid.icn @@ -1,16 +1,16 @@ # ############################################################################ # -# File: jsvalid.icn -# +# File: jsvalid.icn +# # # Subject: This program takes two JSON files (one JSON object file, and one JSON Schema file) -# and compares the two files to make sure the JSON Object File conforms to the JSON Schema file. -# -# +# and compares the two files to make sure the JSON Object File conforms to the JSON Schema file. +# +# # Author: Hunter Thomas, John Haag, and Zachary Kovalenko # -# Date: April 2021 +# Date: April 2021 # ############################################################################ diff --git a/uni/progs/mtrace.icn b/uni/progs/mtrace.icn index 0f8903fb6..aca05f717 100644 --- a/uni/progs/mtrace.icn +++ b/uni/progs/mtrace.icn @@ -11,7 +11,7 @@ # For example, here is the output from this program when run # on a test program: #
    -#Allocation that is not freed: 
    +#Allocation that is not freed:
     #        0x8831f90[    1024 bytes] <- test.c:[197]
     #        0x88337c0[    1024 bytes] <- test.c:[197]
     #        0x8832fb0[    1024 bytes] <- test.c:[197]
    @@ -19,7 +19,7 @@
     #        0x88327a0[    1024 bytes] <- test.c:[197]
     #        0x88333d8[      50 bytes] <- test.c:[159]
     #
    -#Duplicated free: 
    +#Duplicated free:
     #        0x98c1378[    1024 bytes] <- test.c:[209] 
     #        0x98c1b88[    1024 bytes] <- test.c:[209] 
     #        0x98c2398[    1024 bytes] <- test.c:[209] 
    @@ -112,29 +112,29 @@ procedure process(f)
                     tab(many(' \t'))
                     size := tab(0)
                     }
    -             size ?:= (="0x","16r")||tab(0)	# Size to Unicon hex form
    +             size ?:= (="0x","16r")||tab(0)     # Size to Unicon hex form
     
    -             if "+" == action then {	        # malloc
    +             if "+" == action then {            # malloc
                      traceMap[memLoc] :=
                           traceRecord(name, size, memLoc, codeLoc, &null)
                      }
                  else if "-" == action then {       # free
                      tr := traceMap[memLoc] | &null
    -                 if /tr then {		        # No matching malloc?
    +                 if /tr then {                  # No matching malloc?
                          put(noMalloc, mkRec(name, codeLoc, memLoc))
                          }
    -                 else if \tr.freeAddr then {	# Already freed?
    +                 else if \tr.freeAddr then {    # Already freed?
                          put(dupFree, mkFreeRec(name, codeLoc, memLoc, tr))
                          }
                      else {
    -                     tr.freeAddr := memLoc	# Normal free
    +                     tr.freeAddr := memLoc      # Normal free
                          }
                      }
                  }
               }
    -    
    +
         every tr := !traceMap do {
    -        if /tr.freeAddr then {	# No free for malloc?
    +        if /tr.freeAddr then {  # No free for malloc?
                 put(noFree, mkRec(tr.fName, tr.alloAddr, tr.memAddr, tr.size))
                 }
             }
    @@ -192,10 +192,10 @@ procedure getFileAndLine(fName, codeLoc)
         cmdLine := "gdb -q "||
                fName|| "< 0 then {
    -	    url := web["Location"]
    -	    /opts["v"] | write(left("Redirect", 16), ": ", image(url))
    -	    close(web)
    -	    redirect-:=1
    -	}
    -	else
    -	    break
    +        web := &null
    +        web := open(url, mode) | stop("open(", image(url), ") error: ", &errortext )
    +
    +        \web | stop("can't open(", url,")")
    +
    +        if \opts["v"] | \opts["s"] then
    +            showheaders(web)
    +
    +        # if this is a redirect then follow it
    +        if web["Status-Code"] = (301 | 302) & redirect > 0 then {
    +            url := web["Location"]
    +            /opts["v"] | write(left("Redirect", 16), ": ", image(url))
    +            close(web)
    +            redirect-:=1
    +        }
    +        else
    +            break
         }
     
         # make sure the response was OK
         if web["Status-Code"] ~= 200 then {
    -	c := web["Status-Code"]
    -	p := web["Reason-Phrase"]
    -	close(web)
    -	stop("Server response: ", c, " ", p)
    +        c := web["Status-Code"]
    +        p := web["Reason-Phrase"]
    +        close(web)
    +        stop("Server response: ", c, " ", p)
         }
     
         # if we are printing headers only then we are done, otherwise save the file
         if /opts["h"] then {
    -	# save to file or print to screen
    -	if /opts["p"] then {
    -	    write("saving to file ", fname)
    -	    if stat(fname) & /opts["o"] then
    -		close(web) &
    -		stop("file already exists, use -o to overwrite or -f for a new filename")
    -	    fout := open(fname, "w") | stop("open(",image(fname), ") error: ", &errortext)
    -	}
    -	
    -	size := integer(web["Content-Length"]) | -1
    -	t := &time
    -	line := reads(web, size) | stop("reads(",image(web),") error: ", &errortext)
    -	write(fout, line)
    -	close(\fout)
    -	if \opts["v"] then {
    +        # save to file or print to screen
    +        if /opts["p"] then {
    +            write("saving to file ", fname)
    +            if stat(fname) & /opts["o"] then
    +                close(web) &
    +                stop("file already exists, use -o to overwrite or -f for a new filename")
    +            fout := open(fname, "w") | stop("open(",image(fname), ") error: ", &errortext)
    +        }
    +
    +        size := integer(web["Content-Length"]) | -1
    +        t := &time
    +        line := reads(web, size) | stop("reads(",image(web),") error: ", &errortext)
    +        write(fout, line)
    +        close(\fout)
    +        if \opts["v"] then {
                write("file size: ", *line, " bytes")
                write("time: ", &time-t)
                }
    diff --git a/uni/progs/umake.icn b/uni/progs/umake.icn
    index 96def86fe..dcde1877d 100644
    --- a/uni/progs/umake.icn
    +++ b/uni/progs/umake.icn
    @@ -1,12 +1,12 @@
     ############################################################################
     #
    -#	File:     umake.icn
    +#       File:     umake.icn
     #
    -#	Subject:  Unicon version of the "make" program.
    +#       Subject:  Unicon version of the "make" program.
     #
    -#	Author:   Clinton Jeffery
    +#       Author:   Clinton Jeffery
     #
    -#	Date:     August 8, 2013
    +#       Date:     August 8, 2013
     #
     ############################################################################
     #
    @@ -31,20 +31,20 @@ procedure make(argv)
        i := 1
        while i <= *argv do {
           if argv[i]=="-n" then {
    -	 noexec := 1
    -	 delete(argv,i)
    -	 next
    -	 }
    +         noexec := 1
    +         delete(argv,i)
    +         next
    +         }
           else if argv[i]=="-f" then {
    -	 delete(argv,i)			# remove the -f
    -	 makefile := argv[i]
    -	 delete(argv,i)			# remove the filename
    -	 }
    +         delete(argv,i)                 # remove the -f
    +         makefile := argv[i]
    +         delete(argv,i)                 # remove the filename
    +         }
           else if argv[i]=="-v" then {
    -	 verbose := 1
    -	 delete(argv,i)
    -	 next
    -	 }
    +         verbose := 1
    +         delete(argv,i)
    +         next
    +         }
           i +:= 1
           }
        /makefile := "makefile"
    @@ -53,8 +53,8 @@ procedure make(argv)
        else {
           depgraph := DependencyGraph(makefile)
           every i := 1 to *argv do {
    -	 depgraph.make(argv[i])
    -	 }
    +         depgraph.make(argv[i])
    +         }
           }
     end
     
    @@ -75,19 +75,19 @@ class DependencyGraph(targets, initialtarget, marked)
           /dependencies := []
           /buildrules := []
           # if \targets[target] then {
    -	 #
    -	 # Target already exists.  Under some circumstances this ought to
    -	 # be an error/fail/warning, but by default we replace silently.
    -	 #
    -	 #	 write(&errout, "replacing ", image(target))
    -	 # }
    +         #
    +         # Target already exists.  Under some circumstances this ought to
    +         # be an error/fail/warning, but by default we replace silently.
    +         #
    +         #       write(&errout, "replacing ", image(target))
    +         # }
           targets[target] := Rule(target, dependencies, buildrules)
        end
        method add_dependency(source,target)
     
           /targets := Rule(target)
           if not (source == !(targets[target].dependencies)) then
    -	 put(targets[target].dependencies, source)
    +         put(targets[target].dependencies, source)
        end
     
        method mark(s)
    @@ -107,40 +107,40 @@ class DependencyGraph(targets, initialtarget, marked)
           /targ := initialtarget
           if /targ then stop("no initial target? can't make.")
           if /(targets[targ]) then {
    -	 # first, check for matching extensions
    -	 every k := key(targets) do {
    -	    if find("%", k) & (k ~=== "%")  then {
    -	       s := targ
    -	       kk := k
    -	       while s[1]===k[1] do { s[1] := ""; k[1] := "" }
    -	       while s[-1]===k[-1] do { s[-1] := ""; k[-1] := "" }
    -	       if k == "%" & (*s>0) then {
    -		  # instantiate the generic rule
    -		  if \verbose then
    -		     write("instantiating generic rule for ", targ)
    -		  targets[targ] := targets[kk].clone(s)
    -		  return targets[targ].make()
    -		  }
    -	       }
    -	    }
    -	 # last, try a global
    -	 if t := targets["%"] then {
    -	    write("there exists a universal target")
    -	    targets[targ] := targets["%"].clone(targ)
    -	    return targets[targ].make()
    -	    }
    -	 stop("no target for ", image(targ))
    -	 }
    +         # first, check for matching extensions
    +         every k := key(targets) do {
    +            if find("%", k) & (k ~=== "%")  then {
    +               s := targ
    +               kk := k
    +               while s[1]===k[1] do { s[1] := ""; k[1] := "" }
    +               while s[-1]===k[-1] do { s[-1] := ""; k[-1] := "" }
    +               if k == "%" & (*s>0) then {
    +                  # instantiate the generic rule
    +                  if \verbose then
    +                     write("instantiating generic rule for ", targ)
    +                  targets[targ] := targets[kk].clone(s)
    +                  return targets[targ].make()
    +                  }
    +               }
    +            }
    +         # last, try a global
    +         if t := targets["%"] then {
    +            write("there exists a universal target")
    +            targets[targ] := targets["%"].clone(targ)
    +            return targets[targ].make()
    +            }
    +         stop("no target for ", image(targ))
    +         }
           targets[targ].make()
        end
        method get_targets(target)
        local s
           # for version 0, just break on spaces
           target ? {
    -	 while s := tab(find(" ")) do { suspend s; =" " }
    -	 s := tab(0)
    -	 suspend s
    -	 }
    +         while s := tab(find(" ")) do { suspend s; =" " }
    +         s := tab(0)
    +         suspend s
    +         }
        end
     initially(filename)
        filechars := &letters ++ './_%-'
    @@ -150,64 +150,64 @@ initially(filename)
        readahead := []
        if f := open(\filename) then {
           while line := (pop(readahead) | unsplit(f) |
    -		     (close(f) & (f:=pop(fstack)) & unsplit(f))) do {
    -	 line := macroexpand(line)
    +                     (close(f) & (f:=pop(fstack)) & unsplit(f))) do {
    +         line := macroexpand(line)
              line ? {
    -	    tab(many(' '))
    -	    if ="#" then { # skip comment
    -	       # write("comment: ", image(line))
    -	       continue
    -	       }
    -	    else if pos(0) then { # skip empty lines
    -	       continue
    -	       }
    -	    else if ="export" & tab(many(' \t')) &
    -	       (envname := tab(many(filechars))) & =":=" & (val:=tab(0)) then {
    -		  #what the heck, let's expand macro names
    -		  val := macroexpand(val)
    -		  if \verbose then
    -		     write("setting ", envname, " to ", image(val))
    +            tab(many(' '))
    +            if ="#" then { # skip comment
    +               # write("comment: ", image(line))
    +               continue
    +               }
    +            else if pos(0) then { # skip empty lines
    +               continue
    +               }
    +            else if ="export" & tab(many(' \t')) &
    +               (envname := tab(many(filechars))) & =":=" & (val:=tab(0)) then {
    +                  #what the heck, let's expand macro names
    +                  val := macroexpand(val)
    +                  if \verbose then
    +                     write("setting ", envname, " to ", image(val))
     # if Windows... do we need to map PATH to Path, or is PATH OK?
     # need to test.  Mebbe PATH is OK.
    -		  setenv(envname, val)
    -		  }
    -	    else if (target:=tab(many(filechars++' '))) & =":" then { # build a target or targets
    -	       tab(many(' '))
    -	       deps := []
    -	       buildrules := []
    -	       while dependency := tab(many(filechars)) do {
    -		  put(deps,dependency)
    -		  tab(many(' '))
    -		  }
    - 	       # This is a "recipe line", so continuations should not be concatenated
    -	       # i.e. use read(f) directly, rather than unsplit(f)
    -	       while (line := read(f)) & (line[1]=="\t") do {
    -		  put(buildrules, macroexpand(line[2:0]))
    -		  line := &null
    -		  }
    -	       put(readahead, \line)
    -	       every t := get_targets(target) do {
    -		  r := Rule(target,deps,buildrules)
    -		  targets[t] := r
    -		  }
    -	       if not find("%", target, 1) then
    -		  /initialtarget := target
    -	       }
    -	    else if (macroname:=tab(many(filechars))) &
    +                  setenv(envname, val)
    +                  }
    +            else if (target:=tab(many(filechars++' '))) & =":" then { # build a target or targets
    +               tab(many(' '))
    +               deps := []
    +               buildrules := []
    +               while dependency := tab(many(filechars)) do {
    +                  put(deps,dependency)
    +                  tab(many(' '))
    +                  }
    +               # This is a "recipe line", so continuations should not be concatenated
    +               # i.e. use read(f) directly, rather than unsplit(f)
    +               while (line := read(f)) & (line[1]=="\t") do {
    +                  put(buildrules, macroexpand(line[2:0]))
    +                  line := &null
    +                  }
    +               put(readahead, \line)
    +               every t := get_targets(target) do {
    +                  r := Rule(target,deps,buildrules)
    +                  targets[t] := r
    +                  }
    +               if not find("%", target, 1) then
    +                  /initialtarget := target
    +               }
    +            else if (macroname:=tab(many(filechars))) &
                    (tab(many(' '))|"") & ="=" then { # build a macro
    -	       macros[macroname] := macroexpand(tab(0))
    -	       if \verbose then
    -		  write("macro ", macroname, " defined as ", macros[macroname])
    -	       }
    -	    else if ="include" & tab(many(' \t')) &
    -	       (inclname := tab(many(filechars))) then {
    -		  push(fstack, f)
    -		  if \verbose then
    -		     write("including ", image(inclname))
    -		  f := open(inclname)
    -		  }
    -	    else write("??? ", image(line))
    -	    }
    +               macros[macroname] := macroexpand(tab(0))
    +               if \verbose then
    +                  write("macro ", macroname, " defined as ", macros[macroname])
    +               }
    +            else if ="include" & tab(many(' \t')) &
    +               (inclname := tab(many(filechars))) then {
    +                  push(fstack, f)
    +                  if \verbose then
    +                     write("including ", image(inclname))
    +                  f := open(inclname)
    +                  }
    +            else write("??? ", image(line))
    +            }
              }
           close(f)
           }
    @@ -224,31 +224,31 @@ class Rule(target, dependencies, buildrules)
           newRule := Rule(target, copy(dependencies), copy(buildrules))
           newRule.target := subst(newRule.target, percent_sub)
           every d := 1 to *dependencies do {
    -	 newRule.dependencies[d] := subst(newRule.dependencies[d], percent_sub)
    -	 }
    +         newRule.dependencies[d] := subst(newRule.dependencies[d], percent_sub)
    +         }
           every b := 1 to *buildrules do {
    -	 newRule.buildrules[b] := subst(newRule.buildrules[b],
    -					newRule.dependencies[1], "$<")
    -	 }
    +         newRule.buildrules[b] := subst(newRule.buildrules[b],
    +                                        newRule.dependencies[1], "$<")
    +         }
           return newRule
        end
        method make()
        local s
           if depgraph.ismarked(target) then {
    -	 if \verbose then write("umake ", target, " (already made)")
    -	 }
    +         if \verbose then write("umake ", target, " (already made)")
    +         }
           else {
    -	 if \verbose then write("umaking ", target)
    -	 depgraph.mark(target)
    -	 }
    +         if \verbose then write("umaking ", target)
    +         depgraph.mark(target)
    +         }
           # first, recursively build dependencies
           every depgraph.node(!dependencies).make()
     
           # check timestamps of dependencies against my timestamp
           if (not stat(target)) | newer(!dependencies) then {
    -	 exec()
    -	 return
    -	 }
    +         exec()
    +         return
    +         }
           if \verbose then write("umake: `",target, "' is up to date")
        end
        # check me (target timestamp) against d and succeed if d is newer
    @@ -256,22 +256,22 @@ class Rule(target, dependencies, buildrules)
        local mytimestamp, theirtimestamp
           if not (mytimestamp := stat(target).mtime) then return
           if not (theirtimestamp := stat(d).mtime) then
    -	 stop(target, " depends on ", d, " but it didn't get built")
    +         stop(target, " depends on ", d, " but it didn't get built")
           if \verbose then
    -	 write("   ", target,": ", image(mytimestamp), ", ",
    -	       d, ": ", image(theirtimestamp))
    +         write("   ", target,": ", image(mytimestamp), ", ",
    +               d, ": ", image(theirtimestamp))
           if mytimestamp < theirtimestamp then return
        end
        method exec()
        local r
           every r := !buildrules do {
    -	 if \noexec then write(r)
    -	 else {
    -	    if not (rv := system(r)) then
    -	       stop("umake: system(",image(r),") failed")
    -	    if rv ~=== 0 then stop("umake: ", rv, " exit by ", image(r))
    -	    }
    -	 }
    +         if \noexec then write(r)
    +         else {
    +            if not (rv := system(r)) then
    +               stop("umake: system(",image(r),") failed")
    +            if rv ~=== 0 then stop("umake: ", rv, " exit by ", image(r))
    +            }
    +         }
        end
        method print()
            writes("target ", image(target), " : ")
    @@ -296,15 +296,15 @@ end
     procedure macroexpand(s)
        s ? {
           while tab(i := find("$")) &
    -	    ="$(" & (mac := tab(many(filechars))) & =")" do {
    -	 if not member(macros, mac) then {
    -	    if val := getenv(mac|initcap(mac)|map(mac)) then
    -	       macros[mac] := val
    -	    else if \verbose then write("warning: empty macro ", mac)
    -	    }
    -	 s[i +: *mac+3] := macros[mac]
    -	 &subject := s; &pos := i
    -	 }
    +            ="$(" & (mac := tab(many(filechars))) & =")" do {
    +         if not member(macros, mac) then {
    +            if val := getenv(mac|initcap(mac)|map(mac)) then
    +               macros[mac] := val
    +            else if \verbose then write("warning: empty macro ", mac)
    +            }
    +         s[i +: *mac+3] := macros[mac]
    +         &subject := s; &pos := i
    +         }
           }
        return s
     end
    @@ -317,7 +317,7 @@ end
     # and replace the "whitespace \ whitespace" at the join with a single space
     procedure unsplit(f)
         local line := read(f) | fail
    -    if line[-1] == "\\" 
    -    then return trim(line, '\t \\') || " " || trim(\unsplit(f), ' \t', 1) 
    +    if line[-1] == "\\"
    +    then return trim(line, '\t \\') || " " || trim(\unsplit(f), ' \t', 1)
         else return line
     end
    diff --git a/uni/progs/uprof.icn b/uni/progs/uprof.icn
    index e900502f3..a24981ea0 100644
    --- a/uni/progs/uprof.icn
    +++ b/uni/progs/uprof.icn
    @@ -27,15 +27,15 @@ link printf
     $include "evdefs.icn"
     
     # Column widths for output formatting
    -$define PROC_WIDTH	12	# PROCEDURE
    -$define PTIME_WIDTH	5	# %TIME
    -$define TIME_WIDTH	7	# TIME
    -$define CTIME_WIDTH	10	# TIME/CALL
    -$define CALL_WIDTH	10	# CALLS	
    -$define RET_WIDTH	10	# RETURNS
    -$define SUSP_WIDTH	10	# SUSPENDS
    -$define RESUM_WIDTH	10	# RESUMES
    -$define FAIL_WIDTH	6	# FAILS
    +$define PROC_WIDTH      12      # PROCEDURE
    +$define PTIME_WIDTH     5       # %TIME
    +$define TIME_WIDTH      7       # TIME
    +$define CTIME_WIDTH     10      # TIME/CALL
    +$define CALL_WIDTH      10      # CALLS
    +$define RET_WIDTH       10      # RETURNS
    +$define SUSP_WIDTH      10      # SUSPENDS
    +$define RESUM_WIDTH     10      # RESUMES
    +$define FAIL_WIDTH      6       # FAILS
     
     global Proc_stack
     global Call_time_stack
    @@ -64,16 +64,16 @@ procedure main(args)
        local lastline, lines
        local line_time := table(0), line_count := table(0)
        local longest_filename_length := 0
    -   
    +
        if (*args=0) | (args[1] == ("--help"|"-help")) then
            stop("Usage: uprof [-l] [-o outfile] prog args\n",
    -	    "\n",
    -	    "  -l \t\tEnables line-level time sampling\n",
    -	    "  -o outfile \tWwrites output to file 'outfile'\n")
    +            "\n",
    +            "  -l \t\tEnables line-level time sampling\n",
    +            "  -o outfile \tWwrites output to file 'outfile'\n")
     
        if args[1] == "-l" then { pop(args); lines := 1; mask ++:= E_Line }
     
    -   if args[1] == "-o" then { 
    +   if args[1] == "-o" then {
           pop(args)
           output := pop(args) | stop("no output file specified for -o option")
           if *args = 0 then
    @@ -95,22 +95,22 @@ procedure main(args)
     
        #Build the tables
           case &eventcode of {
    -	 E_Line: {
    -	     linetime := keyword("time", Monitored)
    -	     linefile := keyword("file", Monitored)
    -	     longest_filename_length <:= *linefile
    -	     line_count[linefile||":"||&eventvalue] +:= 1
    -	     if delta := (0 < linetime-\last_linetime) then {
    -		 line_time[linefile||":"||&eventvalue] +:= delta
    -	     }
    -	     last_linetime := linetime
    -	 }
    +         E_Line: {
    +             linetime := keyword("time", Monitored)
    +             linefile := keyword("file", Monitored)
    +             longest_filename_length <:= *linefile
    +             line_count[linefile||":"||&eventvalue] +:= 1
    +             if delta := (0 < linetime-\last_linetime) then {
    +                 line_time[linefile||":"||&eventvalue] +:= delta
    +             }
    +             last_linetime := linetime
    +         }
     
              #CALL
              E_Pcall: {
                 push(Proc_stack, val)
                 push(Call_time_stack, (keyword("&time", Monitored)))
    -	    Proc_calls[val] +:= 1
    +            Proc_calls[val] +:= 1
              }
     
              #FAIL
    @@ -125,8 +125,8 @@ procedure main(args)
                 Proc_time[Current_proc] +:= curr_proc_time
     
                 if *Proc_stack > 0 then {
    -                # subtract this proc's runtime from next proc on stack 
    -                Proc_time[Proc_stack[1]] -:= curr_proc_time 
    +                # subtract this proc's runtime from next proc on stack
    +                Proc_time[Proc_stack[1]] -:= curr_proc_time
                 }
              }
     
    @@ -142,7 +142,7 @@ procedure main(args)
                 Proc_time[Current_proc] +:= curr_proc_time
     
                 if *Proc_stack > 0 then {
    -                # subtract this proc's runtime from next proc on stack 
    +                # subtract this proc's runtime from next proc on stack
                     Proc_time[Proc_stack[1]] -:= curr_proc_time
                 }
              }
    @@ -159,7 +159,7 @@ procedure main(args)
                 Proc_time[Current_proc] +:= curr_proc_time
     
                 if *Proc_stack > 0 then {
    -                # subtract this proc's runtime from next proc on stack 
    +                # subtract this proc's runtime from next proc on stack
                     Proc_time[Proc_stack[1]] -:= curr_proc_time
                 }
     
    @@ -185,10 +185,10 @@ procedure main(args)
              proc_end_time := keyword("&time", Monitored)
     
              curr_proc_time := proc_end_time - proc_start_time
    -         Proc_time[Current_proc] +:= curr_proc_time 
    +         Proc_time[Current_proc] +:= curr_proc_time
              if *Proc_stack > 0 then {
    -             # subtract this proc's runtime from next proc on stack 
    -             Proc_time[Proc_stack[1]] -:= curr_proc_time 
    +             # subtract this proc's runtime from next proc on stack
    +             Proc_time[Proc_stack[1]] -:= curr_proc_time
              }
           }
        }
    @@ -209,24 +209,24 @@ procedure main(args)
        #every mxname <:= *image((!keys).keyval)[10:0]
     
        if \outfile then {
    -      write(outfile, left("PROCEDURE",PROC_WIDTH), 
    -            right("%TIME", PTIME_WIDTH), 
    -            right("TIME", TIME_WIDTH), 
    +      write(outfile, left("PROCEDURE",PROC_WIDTH),
    +            right("%TIME", PTIME_WIDTH),
    +            right("TIME", TIME_WIDTH),
                 right("TIME/CALL", CTIME_WIDTH),
    -            right("CALLS", CALL_WIDTH), 
    +            right("CALLS", CALL_WIDTH),
                 right("RETURNS", RET_WIDTH),
    -            right("SUSPENDS", SUSP_WIDTH), 
    -            right("RESUMES",RESUM_WIDTH), 
    -            right("FAILS", FAIL_WIDTH) 
    +            right("SUSPENDS", SUSP_WIDTH),
    +            right("RESUMES",RESUM_WIDTH),
    +            right("FAILS", FAIL_WIDTH)
                )
    -      write(outfile, left("",PROC_WIDTH), 
    -            right("", PTIME_WIDTH), 
    -            right("(ms)", TIME_WIDTH), 
    +      write(outfile, left("",PROC_WIDTH),
    +            right("", PTIME_WIDTH),
    +            right("(ms)", TIME_WIDTH),
                 right("(ms)", CTIME_WIDTH),
    -            right("", CALL_WIDTH), 
    +            right("", CALL_WIDTH),
                 right("", RET_WIDTH),
    -            right("", SUSP_WIDTH), 
    -            right("",RESUM_WIDTH), 
    +            right("", SUSP_WIDTH),
    +            right("",RESUM_WIDTH),
                 right("", FAIL_WIDTH)
                )
            write(outfile)
    @@ -240,11 +240,11 @@ procedure main(args)
                               Proc_fails[y]+Proc_returns[y]+Proc_suspends[y]))
                              ),
                          CTIME_WIDTH),
    -               right(Proc_calls[y], CALL_WIDTH), 
    +               right(Proc_calls[y], CALL_WIDTH),
                    right(Proc_returns[y], RET_WIDTH),
                    right(Proc_suspends[y], SUSP_WIDTH),
    -	       right(Proc_resumes[y], RESUM_WIDTH),
    -	       right(Proc_fails[y], FAIL_WIDTH)
    +               right(Proc_resumes[y], RESUM_WIDTH),
    +               right(Proc_fails[y], FAIL_WIDTH)
                   )
           }
     
    @@ -252,13 +252,13 @@ procedure main(args)
     
           if \lines then {
              write(outfile, sprintf("%"||(longest_filename_length+1)||"s %8s %8s %8s %8s",
    -	       "FILE", "LINE", "TIME", "LINE ", "TIME/LN"))
    +               "FILE", "LINE", "TIME", "LINE ", "TIME/LN"))
              write(outfile, sprintf("%"||(longest_filename_length+1)||"s %8s %8s %8s %8s",
    -	       "    ", "    ", "(ms)", "COUNT", "  (ms) "))
    +               "    ", "    ", "(ms)", "COUNT", "  (ms) "))
              L := reverse(sort(line_time,2))
              every le := !L do {
                 write(outfile, sprintf("%"||(longest_filename_length+1)||"s %8d %8d %8d   %.3r",
    -	          le[1][1:find(":",le[1])], le[1][find(":",le[1])+1:0],
    +                  le[1][1:find(":",le[1])], le[1][find(":",le[1])+1:0],
                       le[2], line_count[le[1]],
                       divimage(le[2], real(line_count[le[1]]))))
              }
    @@ -269,24 +269,24 @@ procedure main(args)
        # print to stdout
        else {
     
    -      write(left("PROCEDURE",PROC_WIDTH), 
    -            right("%TIME", PTIME_WIDTH), 
    -            right("TIME", TIME_WIDTH), 
    +      write(left("PROCEDURE",PROC_WIDTH),
    +            right("%TIME", PTIME_WIDTH),
    +            right("TIME", TIME_WIDTH),
                 right("TIME/CALL", CTIME_WIDTH),
    -            right("CALLS", CALL_WIDTH), 
    +            right("CALLS", CALL_WIDTH),
                 right("RETURNS", RET_WIDTH),
    -            right("SUSPENDS", SUSP_WIDTH), 
    -            right("RESUMES",RESUM_WIDTH), 
    -            right("FAILS", FAIL_WIDTH) 
    +            right("SUSPENDS", SUSP_WIDTH),
    +            right("RESUMES",RESUM_WIDTH),
    +            right("FAILS", FAIL_WIDTH)
                )
    -      write(left("",PROC_WIDTH), 
    -            right("", PTIME_WIDTH), 
    -            right("(ms)", TIME_WIDTH), 
    +      write(left("",PROC_WIDTH),
    +            right("", PTIME_WIDTH),
    +            right("(ms)", TIME_WIDTH),
                 right("(ms)", CTIME_WIDTH),
    -            right("", CALL_WIDTH), 
    +            right("", CALL_WIDTH),
                 right("", RET_WIDTH),
    -            right("", SUSP_WIDTH), 
    -            right("",RESUM_WIDTH), 
    +            right("", SUSP_WIDTH),
    +            right("",RESUM_WIDTH),
                 right("", FAIL_WIDTH)
                )
            write()
    @@ -300,11 +300,11 @@ procedure main(args)
                               Proc_fails[y]+Proc_returns[y]+Proc_suspends[y]))
                              ),
                          CTIME_WIDTH),
    -               right(Proc_calls[y], CALL_WIDTH), 
    +               right(Proc_calls[y], CALL_WIDTH),
                    right(Proc_returns[y], RET_WIDTH),
                    right(Proc_suspends[y], SUSP_WIDTH),
    -	       right(Proc_resumes[y], RESUM_WIDTH),
    -	       right(Proc_fails[y], FAIL_WIDTH)
    +               right(Proc_resumes[y], RESUM_WIDTH),
    +               right(Proc_fails[y], FAIL_WIDTH)
                   )
           }
     
    @@ -312,15 +312,15 @@ procedure main(args)
     
           if \lines then {
              write(sprintf("%"||(longest_filename_length+1)||"s %8s %8s %8s %8s",
    -	       "FILE", "LINE", "TIME", "LINE ", "TIME/LN"))
    +               "FILE", "LINE", "TIME", "LINE ", "TIME/LN"))
              write(sprintf("%"||(longest_filename_length+1)||"s %8s %8s %8s %8s",
    -	       "    ", "    ", "(ms)", "COUNT", "  (ms) "))
    +               "    ", "    ", "(ms)", "COUNT", "  (ms) "))
              L := reverse(sort(line_time,2))
              every le := !L do {
                 write(sprintf("%"||(longest_filename_length+1)||"s %8d %8d %8d   %.3r",
    -	          le[1][1:find(":",le[1])], le[1][find(":",le[1])+1:0],
    -	          le[2], line_count[le[1]],
    -	          divimage(le[2], real(line_count[le[1]]))))
    +                  le[1][1:find(":",le[1])], le[1][find(":",le[1])+1:0],
    +                  le[2], line_count[le[1]],
    +                  divimage(le[2], real(line_count[le[1]]))))
              }
           }
        }
    diff --git a/uni/progs/ush.icn b/uni/progs/ush.icn
    index 18dd5163d..37bbe5393 100644
    --- a/uni/progs/ush.icn
    +++ b/uni/progs/ush.icn
    @@ -65,44 +65,44 @@ procedure ush(s)
        s ? {
           tab(many(' \t'))
           if ="(" then {  # should do paren balancing; too much work for now
    -	 subcmd := tab(find(")")) |stop("unclosed parentheses in\n  ",image(s))
    -	 =")"
    +         subcmd := tab(find(")")) |stop("unclosed parentheses in\n  ",image(s))
    +         =")"
     #write("trying subcmd ", image(subcmd))
    -	 i2 := system("sh.exe " || subcmd)
    -	 tab(many(' \t'))
    -	 if pos(0) then return
    -	 if ="&&" then {
    +         i2 := system("sh.exe " || subcmd)
    +         tab(many(' \t'))
    +         if pos(0) then return
    +         if ="&&" then {
     #write("trying &&, i2 ", image(i2))
    -	    if i2 ~=== 0 then exit(i2)
    -	    return ush(tab(0))
    -	    }
    -	 else if ="||" then {
    +            if i2 ~=== 0 then exit(i2)
    +            return ush(tab(0))
    +            }
    +         else if ="||" then {
     #write("trying ||, i2 ", image(i2))
    -	    if i2 === 0 then return
    -	    return ush(tab(0))
    -	    }
    -	 else stop("syntax error after parens in\n  ",image(s))
    -	 }
    +            if i2 === 0 then return
    +            return ush(tab(0))
    +            }
    +         else stop("syntax error after parens in\n  ",image(s))
    +         }
     
            # perform variable substitution
            while tab((i := find("$"))+1) do {
    -	   var := tab(many(&letters++&digits++'_'))
    -#	   write("var ", var, " replaced as ", variables[var])
    -	   s := &subject := s[1:i] || (\variables)[var] || s[i+1+*var:0] |
    -	       stop("can't variable substitute in\n\t", image(s))
    +           var := tab(many(&letters++&digits++'_'))
    +#          write("var ", var, " replaced as ", variables[var])
    +           s := &subject := s[1:i] || (\variables)[var] || s[i+1+*var:0] |
    +               stop("can't variable substitute in\n\t", image(s))
            }
     
            # perform command substitutions
            while tab((i := find("`"))+1) do {
    -	   cmdsub := tab(find("`"))
    +           cmdsub := tab(find("`"))
     #if match("basename",cmdsub) then cmdsub[1:9] := "c:\\bin\\basename.exe"
                if not (fcmd := open(cmdsub, "p")) then
    -	       stop("popen failed ", image(cmdsub))
    -	   cmdout := read(fcmd)
    -	   close(fcmd)
    -#	   write("cmdsub ", cmdsub, " replaced as ", cmdout)
    -	   s := &subject := s[1:i] || cmdout || s[i+2+*cmdsub:0] |
    -	       stop("can't command substitute in\n\t", image(s))
    +               stop("popen failed ", image(cmdsub))
    +           cmdout := read(fcmd)
    +           close(fcmd)
    +#          write("cmdsub ", cmdsub, " replaced as ", cmdout)
    +           s := &subject := s[1:i] || cmdout || s[i+2+*cmdsub:0] |
    +               stop("can't command substitute in\n\t", image(s))
            }
     
           tab(many(' \t'))
    @@ -112,26 +112,26 @@ procedure ush(s)
              # handle assignments, but only in initial position
              if ="=" then {
                 if *av ~=== 0 then {
    -		cmd ||:= "="
    -		cmd ||:= tab(many(&cset -- ' \t'))
    +                cmd ||:= "="
    +                cmd ||:= tab(many(&cset -- ' \t'))
     #write("cmd revised to ", cmd)
    -		put(av, cmd)
    -		tab(many(' \t'))
    -		next
    -	    }
    -	    tab(many(' \t'))
    -	    if ="\"" then {
    -		val := tab(find("\""))
    -		move(1)
    -		}
    -	    else val := tab(many(&letters++&digits++'._/'))
    -	    setenv(cmd, val)
    +                put(av, cmd)
    +                tab(many(' \t'))
    +                next
    +            }
    +            tab(many(' \t'))
    +            if ="\"" then {
    +                val := tab(find("\""))
    +                move(1)
    +                }
    +            else val := tab(many(&letters++&digits++'._/'))
    +            setenv(cmd, val)
     #write("setting ", image(cmd), " -> ", image(val))
                 /variables := table()
    -	    variables[cmd] := val
    +            variables[cmd] := val
              tab(many(' \t'))
    -	    next
    -	    }
    +            next
    +            }
              tab(many(' \t'))
              if cmd == "&&" then {
                  if (i := run(av)) ~= 0 then exit(i)
    @@ -140,21 +140,21 @@ procedure ush(s)
              else if cmd == "#" then {
                  if (i := run(av)) ~= 0 then exit(i)
                  av := [ ]
    -	     return
    -	     }
    +             return
    +             }
              else if (av[1] ~=== "if") & (cmd[-1] == ";") then {
    -	     if *cmd>1 then put(av, cmd[1:-1])
    +             if *cmd>1 then put(av, cmd[1:-1])
                  run(av)
                  av := [ ]
                  }
               else {
    -	      sizcmd := *av
    -	      every put(av, glob(cmd))
    -	      if *av = sizcmd then {
    -		  write(image(s), ": no match")
    -		  fail
    -	      }
    -	  }
    +              sizcmd := *av
    +              every put(av, glob(cmd))
    +              if *av = sizcmd then {
    +                  write(image(s), ": no match")
    +                  fail
    +              }
    +          }
           }
           if (i := run(av)) ~=== 0 then exit(i)
        }
    @@ -182,23 +182,23 @@ procedure catt(av)
        pop(av)              # discard "cat"
        if match(">>", av[-1]) then {
            if not (fout := open(av[-1][3:0],"a")) then
    -	   stop("can't append to ", av[3])
    +           stop("can't append to ", av[3])
            pull(av)
        }
        else if match(">", av[-1]) then {
            if not (fout := open(av[-1][3:0],"w")) then
    -	   stop("can't write to ", av[3])
    +           stop("can't write to ", av[3])
            pull(av)
        }
        else if av[-2] == ">>" then {
            if not (fout := open(av[-1],"a")) then
    -	   stop("can't append to ", av[-1])
    +           stop("can't append to ", av[-1])
            pull(av)
            pull(av)
        }
        else if av[-2] == ">" then {
            if not (fout := open(av[-1],"w")) then
    -	   stop("can't write to ", av[-1])
    +           stop("can't write to ", av[-1])
            pull(av)
            pull(av)
        }
    @@ -251,18 +251,18 @@ local varname
           line := Lscript[Lscript_i]
           Lscript_i +:= 1
           line ? {
    -	  tab(many(' \t'))
    -	  case tab(0) of {
    -	      "do": numdo +:= 1
    -	      "done": numdo -:= 1
    -	      }
    +          tab(many(' \t'))
    +          case tab(0) of {
    +              "do": numdo +:= 1
    +              "done": numdo -:= 1
    +              }
               }
            }
        if numdo > 0 then stop("malformed 'for' block")
        Lscript_i -:= 1 #points at "done", will advance to line after that
        newList := Lscript[forstart : Lscript_i] # slice not including "done"
     
    -   
    +
        every variables[varname] := !av do {
          runlist(newList)
        }
    @@ -273,21 +273,21 @@ procedure echo(av)
        fout := &output
        if av[-2] == ">>" then {
           if not (fout := open(av[-1],"a")) then
    -	  stop("can't append to ", av[-1])
    +          stop("can't append to ", av[-1])
           pull(av); pull(av)
        }
        else
        if av[-2] == ">" then {
           if not (fout := open(av[-1],"w")) then
    -	  stop("can't write to ", av[-1])
    +          stop("can't write to ", av[-1])
           pull(av); pull(av)
        } else if av[-1][1:3] == ">>" then {
           if not (fout := open(av[-1][3:0],"a")) then
    -	  stop("can't append to ", av[-1][3:0])
    +          stop("can't append to ", av[-1][3:0])
           pull(av)
        } else if av[-1][1] == ">" then {
           if not (fout := open(av[-1][2:0],"w")) then
    -	  stop("can't write to ", av[-1][2:0])
    +          stop("can't write to ", av[-1][2:0])
           pull(av)
        }
     
    @@ -326,38 +326,38 @@ local cond
           Lscript_i +:= 1
           then_start := Lscript_i
           until (trim(Lscript[Lscript_i],,0) == "fi") | (Lscript_i > *Lscript) do {
    -	 Lscript_i +:= 1
    -	 }
    +         Lscript_i +:= 1
    +         }
           if trim(Lscript[Lscript_i],,0) == "fi" then {
    -	 newList := Lscript[then_start : Lscript_i] # slice not including "fi"
    -	 }
    +         newList := Lscript[then_start : Lscript_i] # slice not including "fi"
    +         }
           else stop("if without fi: ")
           }
     
        if (i===0 & /ifnot) | (i~===0 & \ifnot) then {
           # test passed, execute then-part
           if *av == 1 then {
    -	 # executing separate-line then-part
    -	 runlist(newList)
    -	 }
    +         # executing separate-line then-part
    +         runlist(newList)
    +         }
           else if av[1] == "then" then {
    -	 pop(av)
    -	 thenpart := [ ]
    -	 while av[1] ~=== "fi" do put(thenpart, pop(av))
    -	 if thenpart[1] == "{" then pop(thenpart)
    -	 if thenpart[-1] == "}" then pull(thenpart)
    -	 ush(stringify(thenpart))
    -	 }
    +         pop(av)
    +         thenpart := [ ]
    +         while av[1] ~=== "fi" do put(thenpart, pop(av))
    +         if thenpart[1] == "{" then pop(thenpart)
    +         if thenpart[-1] == "}" then pull(thenpart)
    +         ush(stringify(thenpart))
    +         }
           else stop("then expected")
           }
        else {
           # skipping over then-part on *av words
           if *av == 1 then {
    -	 # skip over separate-line then-part
    -	 }
    +         # skip over separate-line then-part
    +         }
           else {
    -	 while av[1] ~=== "fi" do pop(av)
    -	 }
    +         while av[1] ~=== "fi" do pop(av)
    +         }
           }
     end
     
    @@ -371,17 +371,17 @@ end
     procedure test(av)
        case av[2] of {
            "-f": {
    -	   if (str := stat(av[3])) then {
    -#	      write("test ",av[2]," ",av[3]," succeeded")
    -	      return 0
    -	   }
    -	   else {
    -#	      write("test ",av[2]," ",av[3]," failed")
    -	      return -1
    -	   }
    +           if (str := stat(av[3])) then {
    +#             write("test ",av[2]," ",av[3]," succeeded")
    +              return 0
    +           }
    +           else {
    +#             write("test ",av[2]," ",av[3]," failed")
    +              return -1
    +           }
            }
            default: {
    -	   stop("don't know how to test ", image(av[2]))
    +           stop("don't know how to test ", image(av[2]))
            }
        }
     end
    @@ -392,7 +392,7 @@ procedure cond(L)
         if not pull(L) == "]" then stop("conditional trouble, missing ]")
         case L[1] of {
           "-f": { # should be more picky, and check whether L[2] is regular
    -	  if stat(L[2]) then return 0
    +          if stat(L[2]) then return 0
               else return -1
           }
          }
    @@ -420,13 +420,13 @@ procedure run(av)
     #  write("first searching for ", line, " in: ", getenv("PATH"))
           every foo := ((".\\" | getpaths()) || line) do {
              if stat(foo) then {
    -	  line := foo
    -	  if not (line[-4:0] == (".exe" | ".com" | ".bat")) then {
    +          line := foo
    +          if not (line[-4:0] == (".exe" | ".com" | ".bat")) then {
                  av[1] := line
                  runscript(av)
                  return
    -	     }
    -	  break
    +             }
    +          break
               }
             }
     
    @@ -459,15 +459,15 @@ dir := "."
     
        if not (fdir := open(dir)) then {
            stop("can't open ",image(dir)," in ", chdir(),
    -	    "\n...wanted to glob ", image(s))
    +            "\n...wanted to glob ", image(s))
        }
     #   write("globbing ", s, " in dir ", dir, " (chdir ", chdir(), ")")
        while fnam := read(fdir) do {
           if (s[1]=="*" & fnam[-(*s-1) : 0] == s[2:0]) |
    -	  (s[-1]=="*" & fnam[1 : (*s)] == s[1:-1]) then {
    -	      if dir ~== "." then suspend dir ||"\\"|| fnam
    -	      else
    -		  suspend fnam
    +          (s[-1]=="*" & fnam[1 : (*s)] == s[1:-1]) then {
    +              if dir ~== "." then suspend dir ||"\\"|| fnam
    +              else
    +                  suspend fnam
           }
        }
        close(fdir)
    diff --git a/uni/progs/uwc.icn b/uni/progs/uwc.icn
    index cc684611b..bab040ea2 100644
    --- a/uni/progs/uwc.icn
    +++ b/uni/progs/uwc.icn
    @@ -9,14 +9,14 @@ link strings
     procedure main(av)
        while fn := pop(av) do {
           if not (f := open(fn)) then {
    -	 write(&errout, "cannot open ", fn)
    -	 }
    +         write(&errout, "cannot open ", fn)
    +         }
           chars := lines := words := 0
           while line := read(f) do {
    -	 lines +:= 1
    -	 chars +:= *line
    -	 words +:= *wordlist(line)
    -	 }
    +         lines +:= 1
    +         chars +:= *line
    +         words +:= *wordlist(line)
    +         }
           close(f)
           chars +:= lines # newlines
           write(" ", lines, " ", words, " ", chars, " ", fn)
    
    From 590b2b22bd0c5033b72b54fd7328eb33e15e5303 Mon Sep 17 00:00:00 2001
    From: Don Ward 
    Date: Sun, 10 Mar 2024 14:34:00 +0000
    Subject: [PATCH 6/7] Convert tabs to spaces (uni/udb).
    
    ---
     uni/udb/breakpoint.icn         | 124 +++++++++++++-------------
     uni/udb/data.icn               | 126 +++++++++++++-------------
     uni/udb/dta/temporals.icn      | 158 ++++++++++++++++-----------------
     uni/udb/evaluator.icn          |  48 +++++-----
     uni/udb/help.icn               |  76 ++++++++--------
     uni/udb/icode.icn              |  28 +++---
     uni/udb/lib/counter_deref.icn  |  22 ++---
     uni/udb/lib/counter_line.icn   |  22 ++---
     uni/udb/lib/counter_pcall.icn  |  22 ++---
     uni/udb/lib/counter_syntax.icn |  22 ++---
     uni/udb/session.icn            |  84 +++++++++---------
     uni/udb/stack.icn              |  34 +++----
     uni/udb/state.icn              |  74 +++++++--------
     uni/udb/stepping.icn           | 130 +++++++++++++--------------
     uni/udb/symtab.icn             | 156 ++++++++++++++++----------------
     uni/udb/trace.icn              | 104 +++++++++++-----------
     uni/udb/udap/dapcom.icn        |  24 ++---
     uni/udb/watchpoint.icn         | 130 +++++++++++++--------------
     18 files changed, 692 insertions(+), 692 deletions(-)
    
    diff --git a/uni/udb/breakpoint.icn b/uni/udb/breakpoint.icn
    index c4904668c..ba63af742 100644
    --- a/uni/udb/breakpoint.icn
    +++ b/uni/udb/breakpoint.icn
    @@ -17,7 +17,7 @@ record breakPt(
        line,  # The exact line number where the breakpoint is
        state, # an integer code with (ENABLED | DISABLED | DELETED)
        code,  # a copy of the actual source code of that line
    -   coexp  # instance of class Coexp, holds the value of the coexp that the 
    +   coexp  # instance of class Coexp, holds the value of the coexp that the
               # breakpoint is applied to, value is &null if applied to all coexps
        )
     
    @@ -76,12 +76,12 @@ end
     method constructBpMsg(bp, verbose)
        local breakpoint := "", coexp := "", src_code := ""
        local bpTable := table()
    -   
    +
        if /bp then return "" # null breakpoint?
    -   
    -   breakpoint ||:= "\n   Breakpoint #"|| bp.id || 
    +
    +   breakpoint ||:= "\n   Breakpoint #"|| bp.id ||
                        " (" || getBreakState(bp.state) || ") at " ||
    -                   bp.fname || ":" || bp.line 
    +                   bp.fname || ":" || bp.line
        bpTable["id"] := bp.id
        bpTable["state"] := getBreakState(bp.state)
        bpTable["source"] := bp.fname
    @@ -123,7 +123,7 @@ method printBreakInfo(cmd)
        }
        else {
           if integer(name) then {
    -	      every x := key(breakPoints) do {
    +         every x := key(breakPoints) do {
                 L := breakPoints[x]
                 every bp := !L do {
                    if name = bp.id then {
    @@ -135,8 +135,8 @@ method printBreakInfo(cmd)
                 }
                 msg||:="\n   Breakpoint #"||name||" is not available."
                 push(resultTable["breakpoints"], bpTable)
    -	      }
    -	   }
    +              }
    +           }
           else {
              if not find(".icn",name) then name ||:= ".icn"
              if DState.srcFile.isSrcFile(name) then {
    @@ -177,7 +177,7 @@ method isBreakExist(fname, line, breakpoint)
        if member(breakPoints, fname) then {
           L := breakPoints[fname]
           every bp := !L do {
    -	 if bp.line = line & bp.state ~= DELETED then {
    +         if bp.line = line & bp.state ~= DELETED then {
     
                 # only when trying to add a breakpoint - check if coexp of
                 # added breakpoint differs from current breakpoint
    @@ -204,12 +204,12 @@ method isBreakExist(fname, line, breakpoint)
                       }
                    # same coexp -> same breakpoint, append to message
                    else {
    -	          msg := "\n   The breakpoint already exists._
    -	                  \n   Type \"break\" to see all breakpoints"
    +                  msg := "\n   The breakpoint already exists._
    +                          \n   Type \"break\" to see all breakpoints"
                       }
                    }
                 # same breakpoint, return id
    -	    return bp.id
    +            return bp.id
                 }
              }
           }
    @@ -237,7 +237,7 @@ method deleteBreakPoint(fname, line)
        L := breakPoints[fname]
        every i := 1 to *L do {
           if L[i].line = line then
    -	 delete(L,i)
    +         delete(L,i)
           }
        if *L = 0 then
           delete(breakPoints, fname)
    @@ -254,13 +254,13 @@ method parse_colon_arg(arg)
        s := ""
     
        # parse cmd[2] for word args, :, and ::
    -   arg ? { 
    +   arg ? {
           # splits words and colons up to last colon
           while c := move(1) do {
              # word arg
    -         if c ~== ":" then s ||:= c 
    +         if c ~== ":" then s ||:= c
              # colon arg
    -         else { 
    +         else {
                 num_colon +:= 1
                 while c := (move(1) == ":") do {
                    num_colon +:= 1
    @@ -271,14 +271,14 @@ method parse_colon_arg(arg)
                                "\n   Try \"help\" or \"help break\" for assistance."
     
                       setResultTable(resultTable, DState.cmdHistory[1]||" is not a known command", "__false__", msg)
    -	      	      DState.Write(resultTable)
    +                      DState.Write(resultTable)
                       fail
                    }
                 }
    -            # append word argument 
    +            # append word argument
                 put(arg_list,s)
                 s := ""
    -             # append colon argument 
    +             # append colon argument
                 every j := 1 to num_colon do  s ||:= ":"
                 put(arg_list,s)
                 num_colon := 0
    @@ -305,7 +305,7 @@ method cmdBreak(cmd)
        if not (DState.State = (LOAD | PAUSE)) then {
           DState.State := ERROR
           msg := "\n   No Program is Loaded_
    -	      \n   Type \"help\" for assistance"
    +              \n   Type \"help\" for assistance"
           setResultTable(resultTable, "No program loaded", &null, msg)
           resultTable["verified"] := "__false__"
           resultTable["reason"] := "failed"
    @@ -323,9 +323,9 @@ method cmdBreak(cmd)
        # [breakcmd] [coexp N] - get co-expression if this syntax is used
        if *cmd >= 4 & cmd[-2] == "coexp" then {
           if /(coexp := DState.coState.get_coexp(cmd[-1])) then {
    -	 DState.State := ERROR
    +         DState.State := ERROR
              msg := "\n   "||cmd[-2]||" "||cmd[-1]||" does not exist."||
    -	        "\n   Use command \"coexp\" to view activated co-expressions."
    +                "\n   Use command \"coexp\" to view activated co-expressions."
              setResultTable(resultTable, "coexp error??", "__false__", msg)
              DState.Write(resultTable)
              fail
    @@ -343,7 +343,7 @@ method cmdBreak(cmd)
           if *arg_list = 1 then {
              arg := cmd[2]
     
    -         # arg is a proc/method, get file and lineno 
    +         # arg is a proc/method, get file and lineno
              if not (line := integer(arg)) then {
                 if (temp := DState.srcFile.findProcMethod(arg)) then {
                 #if (temp := DState.srcFile.findProc(arg)) then {
    @@ -359,32 +359,32 @@ method cmdBreak(cmd)
                    fail
                    }
                 }
    -         # in the case of 'break line' and no filename 
    +         # in the case of 'break line' and no filename
              if /fname then {
                 if DState.State = PAUSE then {
    -      	       fname := keyword("file",MONITORED)
    +               fname := keyword("file",MONITORED)
                    }
                 else
    -	    fname := DState.srcFile.procMainFile
    +            fname := DState.srcFile.procMainFile
                 }
              }
    -      # break file:line 
    +      # break file:line
           else if *arg_list = 3 & arg_list[2] == ":" then {
              fname := arg_list[1]
    -         arg := arg_list[3] 
    +         arg := arg_list[3]
     
    -         if temp := integer(arg) then line := temp 
    +         if temp := integer(arg) then line := temp
              else {
                 msg := "\n   Expected \""||arg||"\" to be a line number." ||
                        "\n   Please try again."
                 setResultTable(resultTable, "Expected " ||arg|| " to be a line number", "__false__", msg)
                 }
              }
    -      # break class::method | break package::procedure 
    +      # break class::method | break package::procedure
           else if *arg_list = 3 & arg_list[2] == "::" then {
     
    -	 pkgname := cname := arg_list[1]
    -	 arg := arg_list[3]
    +         pkgname := cname := arg_list[1]
    +         arg := arg_list[3]
     
              if temp := (DState.srcFile.findPkgProc(pkgname, arg) |
                          DState.srcFile.findClassMethod(cname, arg)) then {
    @@ -399,12 +399,12 @@ method cmdBreak(cmd)
                 fail
                 }
              }
    -      # break package::class::method 
    +      # break package::class::method
           else if *arg_list = 5 & arg_list[2] == "::" & arg_list[4] == "::" then {
     
    -         pkgname := arg_list[1] 
    -         cname := arg_list[3] 
    -         arg := arg_list[5] 
    +         pkgname := arg_list[1]
    +         cname := arg_list[3]
    +         arg := arg_list[5]
     
              if temp := DState.srcFile.findPkgClassMethod(pkgname, cname, arg) then {
                 fname := temp[1]
    @@ -428,11 +428,11 @@ method cmdBreak(cmd)
              return
              }
           }
    -   else if *cmd = 3 then { # break file line 
    +   else if *cmd = 3 then { # break file line
           fname := cmd[2]
           arg   := cmd[3]
     
    -      if temp := integer(arg) then line := temp 
    +      if temp := integer(arg) then line := temp
           }
        else {
           DState.State := ERROR
    @@ -442,13 +442,13 @@ method cmdBreak(cmd)
           DState.Write(resultTable)
           return
           }
    -  
    -   if \fname then 
    +
    +   if \fname then
           if not find(".icn",fname) then fname ||:= ".icn"
     
        #debug("trying to set breakpoint at '",fname,":",line,"'")
        # create breakpoint
    -   if code := DState.srcFile.getSrcLine(fname, line) then 
    +   if code := DState.srcFile.getSrcLine(fname, line) then
           break_point := breakPt(count +:= 1, fname, line, ENABLED, code, coexp)
     
        # record breakPt(fname, linenum, code) only if it doesn't exist already
    @@ -487,7 +487,7 @@ method clearAllBreakpoints()
         if size > 0 then {
            DState.breakMask := set()
            every x := key(breakPoints) do
    -	  delete(breakPoints, x)
    +          delete(breakPoints, x)
            msg := "\n   All breakpoints are cleared; ("||size||" total)."
            setResultTable(resultTable, &null, "__true__")
            resultTable["size"] := size
    @@ -497,7 +497,7 @@ method clearAllBreakpoints()
            msg := "\n   No breakpoints are available to be cleared."
            setResultTable(resultTable, "No breakpoints available", "__false__")
           }
    -   
    +
         setResultTable(resultTable, &null, &null, msg)
         DState.Write(resultTable)
         return
    @@ -520,7 +520,7 @@ method cmdClear(cmd)
        if *cmd = 3 then {
           arg := cmd[3]
     
    -      # arg is a proc/method, get file and lineno 
    +      # arg is a proc/method, get file and lineno
           if not (line := integer(arg)) then {
              if (temp := DState.srcFile.findProc(arg)) then {
                 fname := temp[1]
    @@ -536,16 +536,16 @@ method cmdClear(cmd)
                 }
              }
     
    -      # in the case of 'break line' and no filename 
    +      # in the case of 'break line' and no filename
           if /fname then {
              if DState.State = PAUSE then {
    -      	    fname := keyword("file",MONITORED)
    +            fname := keyword("file",MONITORED)
                 }
              else
    -	 fname := DState.srcFile.procMainFile
    +         fname := DState.srcFile.procMainFile
              }
           }
    -   # 'break file line' | 'break file all' 
    +   # 'break file line' | 'break file all'
        else if *cmd = 4 then {
           if DState.srcFile.isSrcFile(cmd[3]) | DState.srcFile.isSrcFile(cmd[3] || ".icn") then
              fname := cmd[3]
    @@ -579,7 +579,7 @@ method cmdClear(cmd)
     
        if \fname then {
           if not find(".icn", fname) then
    -	 fname ||:= ".icn"
    +         fname ||:= ".icn"
           }
     
        if \line then {
    @@ -682,7 +682,7 @@ method cmdDelete(cmd)
        }
        else {
           msg:="\n   Undefined Command: \""||DState.cmdHistory[1]||"\""||
    -	   "\n   Try \"help\" for assistance."
    +           "\n   Try \"help\" for assistance."
           setResultTable(resultTable, "Undefined Command: "||DState.cmdHistory[1], "__false__", msg)
           DState.Write(resultTable)
           fail
    @@ -745,8 +745,8 @@ method cmdEnable(cmd)
                       DState.Write(resultTable)
                       fail
                    }
    -	    }
    -	 }
    +            }
    +         }
           msg := "\n   Breakpoint #"||id||" is not available."
           setResultTable(resultTable, "Breakpoint #"||id||" is not available", "__false__", msg)
           DState.Write(resultTable)
    @@ -754,7 +754,7 @@ method cmdEnable(cmd)
           }
        else {
           msg:="\n   Undefined Command: \""||DState.cmdHistory[1]||"\""||
    -	   "\n   Try \"help\" for assistance."
    +           "\n   Try \"help\" for assistance."
           setResultTable(resultTable, "Undefined Command: "||DState.cmdHistory[1], "__false__", msg)
           DState.Write(resultTable)
           fail
    @@ -769,13 +769,13 @@ method cmdDisable(cmd)
     
        if not cmd[3] then {
           every x := key(breakPoints) do {
    -	 L := breakPoints[x]
    -	 every bp := !L do
    -	    if bp.state := ENABLED then {
    -	       bp.state := DISABLED
    -	       j +:= 1
    -	    }
    -	 }
    +         L := breakPoints[x]
    +         every bp := !L do
    +            if bp.state := ENABLED then {
    +               bp.state := DISABLED
    +               j +:= 1
    +            }
    +         }
           if j > 0 then {
              msg := "\n   All breakpoints are disabled; ("||j||" total)."
              setResultTable(resultTable, "All breakpoints are disabled; ("||j||" total)", "__true__")
    @@ -823,7 +823,7 @@ method cmdDisable(cmd)
        }
        else {
           msg:="\n   Undefined Command: \""||DState.cmdHistory[1]||"\""||
    -	   "\n   Try \"help\" for assistance."
    +           "\n   Try \"help\" for assistance."
           setResultTable(resultTable, "Undefined Command: "||cmdHistory[1], "__false__", msg)
           DState.Write(resultTable)
           fail
    @@ -837,7 +837,7 @@ method resetBreakpoints()
         if size > 0 then {
            DState.breakMask := set()
            every x := key(breakPoints) do
    -	  delete(breakPoints, x)
    +          delete(breakPoints, x)
            count := 0
            }
         return
    diff --git a/uni/udb/data.icn b/uni/udb/data.icn
    index e5f88d548..94a84ef7d 100644
    --- a/uni/udb/data.icn
    +++ b/uni/udb/data.icn
    @@ -24,7 +24,7 @@ class Data(
     method printGlobals(level)
        local x, i, CMonitored := DState.coState.target.val, output := [], globalsTable, variableTable
     
    -   /level := DState.coState.target.curr_frame 
    +   /level := DState.coState.target.curr_frame
        globalsTable := table()
        globalsTable["type"] := "globals"
     
    @@ -88,7 +88,7 @@ end
     method printStatics(level)
        local x, i, CMonitored := DState.coState.target.val, output := [], staticsTable, variableTable
     
    -   /level := DState.coState.target.curr_frame 
    +   /level := DState.coState.target.curr_frame
        staticsTable := table()
        staticsTable["type"] := "statics"
     
    @@ -106,7 +106,7 @@ method printStatics(level)
              put(output, variableTable)
           }
        }
    -   
    +
        staticsTable["variables"] := output
        if /DState.mode | \DState.mode ~== "-adapter" then
           more(output)
    @@ -120,7 +120,7 @@ end
     method printParams(level)
        local x, i, CMonitored := DState.coState.target.val, output := [], paramsTable, variableTable
     
    -   /level := DState.coState.target.curr_frame 
    +   /level := DState.coState.target.curr_frame
        paramsTable := table()
        paramsTable["type"] := "params"
     
    @@ -224,31 +224,31 @@ method getVarReference(Var, index, level)
                if \x1 & /x2 then {
                   if v := variable(x1, CMonitored, level) | integer(x1) then {
                      if abs(v) <= *Var then {
    -   		    Var := Var[v]
    -		    return Var
    -		    }
    +                    Var := Var[v]
    +                    return Var
    +                    }
                      else {
                         Message := "\n   The string subscript \""||x1||
                                    "\" is out of range."
                         }
    -		 }
    -	      else {
    -		 #write("can't get variable reference ", image(Var),
    -		 #      "[", image(v), "]")
    +                 }
    +              else {
    +                 #write("can't get variable reference ", image(Var),
    +                 #      "[", image(v), "]")
                      Message := "\n   The string subscript \""||x1||
                                 "\" is invalid."
    -		 fail
    -		 }
    +                 fail
    +                 }
                   }
                else if \x1 & \x2 then {
    -	      if x2 === "][" then {
    +              if x2 === "][" then {
                      Message := "\n   Strings cannot have double subscripts."
    -		 fail
    -		 }
    +                 fail
    +                 }
                   # string slice
    -	      else {
    -		 i1 := variable(x1, CMonitored, level) | integer(x1)
    -		 i2 := variable(x2, CMonitored, level) | integer(x2)
    +              else {
    +                 i1 := variable(x1, CMonitored, level) | integer(x1)
    +                 i2 := variable(x2, CMonitored, level) | integer(x2)
                      if abs(i1) > *Var then {
                         Message := "\n   The string subscript \""||x1||
                                    "\" is out of range."
    @@ -259,9 +259,9 @@ method getVarReference(Var, index, level)
                                    "\" is out of range."
                         fail
                         }
    -		 Var := Var[i1:i2]
    -		 return Var
    -		 }
    +                 Var := Var[i1:i2]
    +                 return Var
    +                 }
                   }
                else {
                   Message := "\n   Invalid expression."
    @@ -292,10 +292,10 @@ method getVarReference(Var, index, level)
                         Var := Var[v]
                         return getVarReference(Var, index, level)
                         }
    -                 else { 
    +                 else {
                         Message := "\n   The list subscript \""||x1||
                                    "\" is out of range."
    -                    fail 
    +                    fail
                         }
                      }
                   else if x1 == "][" then {
    @@ -307,7 +307,7 @@ method getVarReference(Var, index, level)
                      else {
                         Message := "\n   The list subscript \""||x2||
                                    "\" is out of range."
    -                    fail 
    +                    fail
                         }
                      }
                   else{
    @@ -374,7 +374,7 @@ method setVarReference(lvar, index, level, value)
              return Var
              }
           else {
    -         Message := "\n   Something went wrong." 
    +         Message := "\n   Something went wrong."
              fail
              }
        }
    @@ -525,7 +525,7 @@ method printVar(Expr, action, level)
                      if (type(ref) == ("list" | "table" | "set" | "foreign-local" )|
                          match("record"|"object",image(ref))) & *ref >= 1 then {
                             Message ||:= ximage(ref)
    -			}
    +                        }
                      else{
                             Message ||:= image(ref)
                          }
    @@ -600,7 +600,7 @@ method cmdPrint(cmd)
              if *(cmd[1]) = 1 then action := pop(cmd[1])
              else {
                 action := cmd[1][1]
    -            cmd[1] := cmd[1][2:0] 
    +            cmd[1] := cmd[1][2:0]
                 }
              }
           every j := 1 to *cmd do {
    @@ -674,7 +674,7 @@ method assignKeyword(lexpr, rexpr, level)
              var_ref := variable(lexpr, Monitored, 0, 1) := data
              Message := "\n   "||lexpr||" = "||image(var_ref)
              DState.Write(Message)
    -         return 
    +         return
              }
           else{
              DState.Write(Message)
    @@ -866,20 +866,20 @@ method parsePrintExpression(expr)
     
            # first, split multi-token tokens
            x ? {
    -	  if (s := tab(many(&letters++&digits++'_'))) & (*s < *x) then {
    -	     insert(expr,i+1,x[*s+1:0])
    -	     x := expr[i] := s
    -	     }
    -	  else if (c := tab(any('[]'))) & (s := tab(0)) & *s>0 then {
    -	     insert(expr,i+1,s)
    -	     x := expr[i] := c
    -	     }
    -	  else if (c := tab(any(':'))) & (s := tab(0)) & *s>0 &
    -	     (s[1]~=="=") then {
    -	     insert(expr,i+1,s)
    -	     x := expr[i] := c
    -	     }
    -	  }
    +          if (s := tab(many(&letters++&digits++'_'))) & (*s < *x) then {
    +             insert(expr,i+1,x[*s+1:0])
    +             x := expr[i] := s
    +             }
    +          else if (c := tab(any('[]'))) & (s := tab(0)) & *s>0 then {
    +             insert(expr,i+1,s)
    +             x := expr[i] := c
    +             }
    +          else if (c := tab(any(':'))) & (s := tab(0)) & *s>0 &
    +             (s[1]~=="=") then {
    +             insert(expr,i+1,s)
    +             x := expr[i] := c
    +             }
    +          }
            i +:= 1
            }
     
    @@ -894,17 +894,17 @@ method parsePrintExpression(expr)
                  put(tokens, x[j+1:0])
                  }
               else {
    -	     if (x === "pos") & (tokens[-1]==="&") &
    -		 (expr[i-2] == ("[" | ":")) then {
    -		tokens[-1] ||:= x
    -	        }
    -	     else
    -		put(tokens, x)
    -	     }
    +             if (x === "pos") & (tokens[-1]==="&") &
    +                 (expr[i-2] == ("[" | ":")) then {
    +                tokens[-1] ||:= x
    +                }
    +             else
    +                put(tokens, x)
    +             }
               }
            else if x == "]" & expr[i+1] == "[" then {
               # handle p L[3] [2], "][" is used to indicate new sublist. Otherwise
    -	  # a second index is the back of a slice reference.
    +          # a second index is the back of a slice reference.
               put(tokens,"][")
               }
            else if x == "]" & expr[i+1][1] == "." then {
    @@ -1070,7 +1070,7 @@ end
     # used to print a summary of all used files
     #
     method printSrcSummary(detail)
    -   local found, missing, ftotal, plural 
    +   local found, missing, ftotal, plural
        local packages, classes, records, procs, globals
        local pclasses := [], precords := [], pprocs := [], pglobals := []
     
    @@ -1081,10 +1081,10 @@ method printSrcSummary(detail)
        globals := DState.srcFile.getGlobals()
     
        every pkg := !packages do {
    -      pclasses |||:= DState.srcFile.getClasses(pkg) 
    -      precords |||:= DState.srcFile.getRecords(pkg) 
    -      pprocs |||:= DState.srcFile.getProcedures(pkg) 
    -      pglobals |||:= DState.srcFile.getGlobals(pkg) 
    +      pclasses |||:= DState.srcFile.getClasses(pkg)
    +      precords |||:= DState.srcFile.getRecords(pkg)
    +      pprocs |||:= DState.srcFile.getProcedures(pkg)
    +      pglobals |||:= DState.srcFile.getGlobals(pkg)
           }
     
        found   := *DState.srcFile.foundFiles
    @@ -1183,7 +1183,7 @@ method cmdSource(cmd)
                    else if set_pkg == "" then pkg := &null
                    else {
                       write("\n   Package \"",set_pkg,"\" was not found.",
    -                        "\n   Please try again.") 
    +                        "\n   Please try again.")
                       fail
                       }
                    #write("\n   Current package: ",(\pkg | "none"))
    @@ -1243,7 +1243,7 @@ method cmdSource(cmd)
                    printSrcSummary(1)
                    }
                 # src file
    -            else if *cmd = 2 then { 
    +            else if *cmd = 2 then {
                    if not find(".icn", cmd[2]) then cmd[2] ||:= ".icn"
                    if code := DState.srcFile.getSrcCode(cmd[2]) then {
                       more(code)
    @@ -1260,7 +1260,7 @@ method cmdSource(cmd)
     
        # commands with optional arguments - prints specifics about specified
        # class or package
    -   else if *cmd = 3 then {  
    +   else if *cmd = 3 then {
           op := cmd[2] | ""
           arg := cmd[3] | ""
           if op[1] ~=="-" then op :="-"||op
    @@ -1276,7 +1276,7 @@ method cmdSource(cmd)
                    every i := 1 to *names do put(output,"   #"||i||"  "||names[i])
                    more(output)
                    }
    -            else 
    +            else
                    DState.Write("\n   No class fields found.")
                 }
              "-pkg"|"-pk"|"-package":{
    @@ -1290,7 +1290,7 @@ method cmdSource(cmd)
                    every i := 1 to *names do put(output,"   #"||i||"  "||names[i])
                    more(output)
                    }
    -            else 
    +            else
                    DState.Write("\n   No global names found in package.")
                 }
              default: {
    @@ -1301,7 +1301,7 @@ method cmdSource(cmd)
                 }
              }
           }
    -   # invalid syntax 
    +   # invalid syntax
        else {
           msg := "\n   Undefined command:"
           while msg ||:= " " || pop(cmd)
    @@ -1309,7 +1309,7 @@ method cmdSource(cmd)
           DState.Write(msg)
           fail
           }
    - 
    +
     end
     
     #
    diff --git a/uni/udb/dta/temporals.icn b/uni/udb/dta/temporals.icn
    index e0b215a54..e1f32b2fa 100644
    --- a/uni/udb/dta/temporals.icn
    +++ b/uni/udb/dta/temporals.icn
    @@ -30,7 +30,7 @@ class TempAssert(
        assertTable, # a table that maps each assertion (obj) into its location
        assertList,  # an ordered list with all assertion's locations
     
    -   eventMask,   # a cset of all monitored events in regards of all assertions 
    +   eventMask,   # a cset of all monitored events in regards of all assertions
        msg          # a string with latest message from this class
        )
     
    @@ -61,9 +61,9 @@ method isValidLocation(cmd)
        else if cmd[3] == ":" then{
           if find(".icn", cmd[2]) then
              fname := cmd[2]
    -      else 
    +      else
              fname := cmd[2]||".icn"
    -   
    +
           if x := integer(cmd[4]) then
             line := x
           else{
    @@ -89,7 +89,7 @@ method isValidLocation(cmd)
              fail
              }
           }
    -   
    +
        # ensure the file name and line number are valid
        if DState.srcFile.isSrcFile(fname) then{
           if DState.srcFile.isLoaded(fname) then{
    @@ -109,7 +109,7 @@ method isValidLocation(cmd)
                 }
              else{
                 msg:="\n   Line number "||line||" out of range; "||fname||
    -                 " has "||DState.srcFile.getFileTotalLines(fname)||" lines." 
    +                 " has "||DState.srcFile.getFileTotalLines(fname)||" lines."
                 DState.Write(msg)
                 fail
                 }
    @@ -144,7 +144,7 @@ method cmdAssert(cmd)
           DState.Write(msg)
           fail
           }
    -  
    +
        count +:= 1
        case body[1] of {
          # past time assertions
    @@ -164,15 +164,15 @@ method cmdAssert(cmd)
             DState.State := ERROR
     
             msg := "\n   \""||DState.cmdHistory[1]||"\" Bad assertion syntax.\n" ||
    -	       image(body[1]) || " is not a known command." ||
    -	       "\n   Try \"help\" or \"help assert\" for assistance."
    +               image(body[1]) || " is not a known command." ||
    +               "\n   Try \"help\" or \"help assert\" for assistance."
             DState.Write(msg)
             count -:= 1
             fail
             }
          }
        loc := fname ||":"||line
    -   if /assertTable[loc] then{ 
    +   if /assertTable[loc] then{
           assertTable[loc] := obj
           put(assertList,loc)
           updateMasks()
    @@ -195,12 +195,12 @@ method cmdAssert(cmd)
           else
              count -:= 1
          }
    -      
    +
        #insert(DState.assertLoc, line)
        #DState.assertVars ++:= obj.varNames
        #------------------------------------------------------
    -   #write("------------cmd----------  : \n", ximage(cmd)) 
    -   #write("------------body---------  : \n", ximage(body)) 
    +   #write("------------cmd----------  : \n", ximage(cmd))
    +   #write("------------body---------  : \n", ximage(body))
     end
     
     #
    @@ -248,11 +248,11 @@ method cmdInfo(cmd)
     end
     
     #
    -# forwards relevant events to relevant assertions based on their eventmask 
    +# forwards relevant events to relevant assertions based on their eventmask
     #
     method forward()
        local x
    -   
    +
        #write("-Forward---->",evnames(&eventcode), ": ", image(&eventvalue))
        every x := !assertTable do{
          if x.state = ENABLED & member(x.eventMask, &eventcode) then{
    @@ -261,8 +261,8 @@ method forward()
                E_Value: { if x.waitForValue > 0 then x.handle_event()              }
                E_Line:  { x.handle_event()                                         }
                E_Deref: { if member(x.varNames, &eventvalue) then x.handle_event() }
    -           default: { #if x.triggered = TRUE then 
    -                      x.handle_event()    
    +           default: { #if x.triggered = TRUE then
    +                      x.handle_event()
                         }
                }
             }
    @@ -271,7 +271,7 @@ end
     
     ##
     ## Try to evaluate the assertion when it is ready for evaluation
    -## The evaluation is triggered based on the E_Line event 
    +## The evaluation is triggered based on the E_Line event
     ##
     #method trigger()
     #   local x, loc, fname, line
    @@ -292,15 +292,15 @@ end
     #end
     
     #
    -# it constructs/re-constucts the assertions' eventMask 
    -# from all active assertions whenever an assertion is 
    -# inserted, enabled, disabled  
    +# it constructs/re-constucts the assertions' eventMask
    +# from all active assertions whenever an assertion is
    +# inserted, enabled, disabled
     #
     method updateMasks()
        local x, assertLoc:=set(), assertVars:=set()
     
       # write("----------------------Build mask !!!!!!!!!!!!")
    -   
    +
        # The temporal assertion's eventmask is a union of all enabled
        # assertions event masks + the E_Line event that is used to trigger
        # the assertion
    @@ -322,7 +322,7 @@ end
     # The constructor
     #
     initially()
    -   
    +
        count       := 0
        assertTable := table()
        assertList  := []
    @@ -332,12 +332,12 @@ end
     #------------------------------------------------------------------------------
     
     #
    -# This is an abstract class for all kind of assertions 
    +# This is an abstract class for all kind of assertions
     #
     class Assertion(
        DState,      # (Alias) object of type State class
        id,          # an integer idetifies the number of the assertion
    -   
    +
        pname,       # the procedure name of assertion's virtuall location
        fname,       # the file name of assertion's virtuall location
        line,        # the line number of assertion's virtuall location
    @@ -373,7 +373,7 @@ class Assertion(
        eventMask,   # the set of all monitored events inqured by this assertion
        #valueMask,  # a table maps monitored variables into their monitored events
        varNames,    # a set of all internal names of the assertion vars
    -   msg          # a string with the latest message from this class   
    +   msg          # a string with the latest message from this class
        )
     
     #
    @@ -385,7 +385,7 @@ class Assertion(
     method setCycles()
        local i := 2, x
     
    -   if (body[i] == "(" & body[i+1] == ")") | body[i] == "()" then{ 
    +   if (body[i] == "(" & body[i+1] == ")") | body[i] == "()" then{
           cycle := &null
           }
        else if body[i] == "(" then{
    @@ -413,7 +413,7 @@ method parseBody()
        local i, k, x, vname, vscope, param, obj
     
        setCycles()
    -   
    +
        every i := 1 to *body do
           if body[i] == "{" then break
     
    @@ -431,7 +431,7 @@ method parseBody()
        while(i <= *body & body[i] ~== "}") do{
           x := body[i]
           #write("-----------[",i,"]---[",image(x),"]---")
    -      if member(OPERATOR, x) then{ 
    +      if member(OPERATOR, x) then{
              put(evalList, x)
              k := i
              }
    @@ -479,7 +479,7 @@ method parseBody()
                    k -:= 1
                    break
                    }
    -            else  
    +            else
                    put(param, body[k])
                 }
              put(evalList, param)
    @@ -514,7 +514,7 @@ method parseBody()
              }
           }
     
    -   # 
    +   #
        # print_evalList()
        #
     
    @@ -551,7 +551,7 @@ method parseBody()
     end
     
     #
    -# refresh_evalLiat(): frees all previouslly collected 
    +# refresh_evalLiat(): frees all previouslly collected
     # data during the previous hit
     #
     method refresh_evalList()
    @@ -658,7 +658,7 @@ end
     method handle_event(side)
        local i, x
     
    -   if state = ENABLED then{ 
    +   if state = ENABLED then{
           if /side then{
              #write("handle_event ------------ side = &null")
              # loop over the entier evalList: just in case that the same variable
    @@ -702,7 +702,7 @@ end
     method getResult(oper, val1, val2)
        local i, result
     
    -   if numeric(val1) & numeric(val2) then{ 
    +   if numeric(val1) & numeric(val2) then{
           case oper of{
              ">":  { result := if val1  >  val2 then TRUE else FALSE }
              ">=": { result := if val1  >= val2 then TRUE else FALSE }
    @@ -715,10 +715,10 @@ method getResult(oper, val1, val2)
              "||": { result := if val1  |  val2 then TRUE else FALSE }
              "&"|
              "&&": { result := if val1  &  val2 then TRUE else FALSE }
    -         #"==>"|"-->"|"->"|"=>":{ }# implies : stil to be implemented 
    +         #"==>"|"-->"|"->"|"=>":{ }# implies : stil to be implemented
              }
           }
    -   else if string(val1) & string(val2) then{ 
    +   else if string(val1) & string(val2) then{
           case oper of{
              ">":  { result := if val1 >>  val2 then TRUE else FALSE }
              ">=": { result := if val1 >>= val2 then TRUE else FALSE }
    @@ -733,10 +733,10 @@ method getResult(oper, val1, val2)
     end
     
     ##
    -## saves the surrent evaluation result for future inquiry 
    +## saves the surrent evaluation result for future inquiry
     ##
     #method storeResult(result, side)
    -#   
    +#
     #   if /side then
     #      put(evalHistory, result)
     #   else if side = 1 then
    @@ -759,7 +759,7 @@ method evaluateState(side)
           }
     
        if \implies then{
    -      if /side then 
    +      if /side then
              fail
           else if side = 1 then{
              first  := evalList[1]
    @@ -788,7 +788,7 @@ method evaluateState(side)
     
        if not (type(oper) == "string" & member(OPERATOR, oper)) then{
           result := AssertHistory(val1, val2, oper, NOTVALID, "bad operator!")
    -      if /side | side = 2 then{ 
    +      if /side | side = 2 then{
              /evalStates[hits] := []
              put(evalStates[hits], result)
              #countFail +:= 1
    @@ -799,7 +799,7 @@ method evaluateState(side)
        if /val1 | / val2 then{
           result := AssertHistory(image(val1), image(val2),
                                   oper, NOTVALID, "bad operand!")
    -      if /side | side = 2 then{ 
    +      if /side | side = 2 then{
              /evalStates[hits] := []
              put(evalStates[hits], result)
              #countFail +:= 1
    @@ -809,7 +809,7 @@ method evaluateState(side)
     
        if getResult(oper, val1, val2) = FALSE then{
           result := AssertHistory(val1, val2, oper, FALSE, "!")
    -      if /side | side = 2 then{ 
    +      if /side | side = 2 then{
              /evalStates[hits] := []
              put(evalStates[hits], result)
              #countFail +:= 1
    @@ -818,7 +818,7 @@ method evaluateState(side)
           }
        else{
           result := AssertHistory(val1, val2, oper, TRUE, "!")
    -      if /side | side = 2 then{ 
    +      if /side | side = 2 then{
              /evalStates[hits] := []
              put(evalStates[hits], result)
              }
    @@ -844,15 +844,15 @@ end
     # check the evaluation suite when the result is TRUE
     #
     method check_evalSuite()
    - 
    +
        case evalSuite of{
           HIDE_WHEN_TRUE: { }
    -      STOP_WHEN_TRUE: { writeState() 
    +      STOP_WHEN_TRUE: { writeState()
                             DState.State := PAUSE
                           }
           SHOW_WHEN_TRUE: { writeState()
                           }
    -      PAUSE_WHEN_TRUE:{ writeState() 
    +      PAUSE_WHEN_TRUE:{ writeState()
                             delay(500)
                           }
           }
    @@ -867,9 +867,9 @@ method checkIntervals()
        countTrue := countFalse := 0
        every i := 1 to hits do{
           write("i=",i)
    -      if evalInterval[i] = TRUE then 
    +      if evalInterval[i] = TRUE then
              countTrue +:= 1
    -      else 
    +      else
              countFalse +:= 1
           }
     end
    @@ -892,7 +892,7 @@ end
     #end
     
     #
    -# this methods sets up strCmd with the string body of the assertion 
    +# this methods sets up strCmd with the string body of the assertion
     #
     method setStrBody()
        local i, t
    @@ -926,7 +926,7 @@ initially(DebugState, Pname, Fname, Line, Code, Body, ID)
        location     := 0
        state        := ENABLED
        waitForValue := 0
    -   
    +
        countFail    := 0
        countTrue    := 0
        countFalse   := 0
    @@ -961,7 +961,7 @@ end
     class AssertHistory(
        Val1,   # the first value
        Val2,   # the second value
    -   Oper,   # the operator 
    +   Oper,   # the operator
        Result, # the result
        line,   # the line number of the evaluation
        fname,  # the file name of the evaluation
    @@ -972,22 +972,22 @@ class AssertHistory(
     # returns a formated history for the instance
     #
     method getInfo(i)
    -   
    +
        if /i then{
           return  "\n   "||Val1||" "||Oper||" "||Val2||": "    ||
    -              (if Result = TRUE then "True" 
    +              (if Result = TRUE then "True"
                    else if Result = FALSE then "False" else "Not Valid")  ||
                   " at file "|| fname||":"||line||"; "||Message
           }
        else if i <= 0 then{
           return  Val1||" "||Oper||" "||Val2||": "            ||
    -              (if Result = TRUE then "True" 
    +              (if Result = TRUE then "True"
                    else if Result = FALSE then "False" else "Not Valid")  ||
                   " at file "||fname||":"||line||"; "||Message
           }
        else{
           return  "\n   "||i||"# "||Val1||" "||Oper||" "||Val2||": "||
    -              (if Result = TRUE then "True" 
    +              (if Result = TRUE then "True"
                    else if Result = FALSE then "False" else "Not Valid")  ||
                   " at file "||fname||":"||line||"; "||Message
           }
    @@ -997,14 +997,14 @@ end
     # The constructor of the AssertHistory class
     #
     initially(v1, v2, op, result, msg)
    -   Val1     := v1 
    +   Val1     := v1
        Val2     := v2
        Oper     := op
        Result   := result
        Message  := msg
    -  
    +
        line     := keyword("&line", Monitored)
    -   fname    := keyword("&file", Monitored) 
    +   fname    := keyword("&file", Monitored)
     end
     
     #
    @@ -1021,11 +1021,11 @@ class Always: Assertion()
     
     #
     # this methods handles events received from the evaluator of UDB
    -#  
    +#
     method handle_event()
        #static param_var
        local cur_proc, i, res
    -   
    +
        #write("-Always[-]---->",evnames(&eventcode), ": ", image(&eventvalue))
        if triggered = TRUE then{
           self.Assertion.handle_event()
    @@ -1193,7 +1193,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countFalse + countTrue
    @@ -1326,7 +1326,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countFalse + countTrue
    @@ -1385,7 +1385,7 @@ method handle_event()
              }
           else if &eventcode ~== E_Assign then{
              if evaluateState() = TRUE then
    -            check_evalSuite() 
    +            check_evalSuite()
              }
           }
        else if &eventcode == (E_Pcall | E_Presum) then{
    @@ -1429,7 +1429,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countFalse + countTrue
    @@ -1500,7 +1500,7 @@ method handle_event()
                 }
              else{ #if &eventcode ~== E_Line then
                 self.Assertion.handle_event(2)
    -            if &eventcode ~== E_Assign then{ 
    +            if &eventcode ~== E_Assign then{
                    if (res := evaluateState(2)) = FALSE then
                       evaluateInterval()
                    else if \res = TRUE then
    @@ -1542,7 +1542,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countTrue + countFalse
    @@ -1609,10 +1609,10 @@ method handle_event()
              }
           else{
              self.Assertion.handle_event()
    -         if &eventcode ~== E_Assign then{ 
    +         if &eventcode ~== E_Assign then{
                 if (res := evaluateState()) = TRUE then
                    check_evalSuite()
    -            } 
    +            }
              }
           }
     end
    @@ -1649,7 +1649,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countTrue + countFalse
    @@ -1680,9 +1680,9 @@ end
     
     #
     # This class handles the evaluation of the future time assertion always)
    -# which is equivalent to next 
    -# This kind of assertions is triggered when their virtual location is 
    -# reached for the first time 
    +# which is equivalent to next
    +# This kind of assertions is triggered when their virtual location is
    +# reached for the first time
     #
     class AlwaysF: Assertion()
     
    @@ -1766,7 +1766,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countTrue + countFalse
    @@ -1829,7 +1829,7 @@ method handle_event()
                 }
              else if &eventcode == E_Line then
                 location +:= 1
    -         else{ 
    +         else{
                 if evaluateState() = TRUE then
                    check_evalSuite()
                 }
    @@ -1838,7 +1838,7 @@ method handle_event()
        else if &eventcode == E_Line & /pre_triggered then{
           cur_file := keyword("&file", Monitored)
           if &eventvalue = line & cur_file == fname then{
    -         pre_triggered := TRUE 
    +         pre_triggered := TRUE
              triggered     := TRUE
              hits +:= 1
              self.Assertion.handle_event(-1)
    @@ -1875,7 +1875,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        #checkIntervals()
        #x := countTrue + countFalse
    @@ -1968,7 +1968,7 @@ end
     # at the end of the program, it checks the state of this assertion
     #
     method checkEvaluation()
    -   local x 
    +   local x
     
        if falseHits > 0 then{
           evalValue := FALSE
    @@ -2080,7 +2080,7 @@ method checkEvaluation()
           evalValue := TRUE
           msg   := "\n   Assertion #"||id||" at "||fname||","||line||": "||strCmd
           msg ||:= ": (Valid "||part2_CountTrue||" out of "||x||")."
    -      msg ||:= "\n   Ended at file "||evaluated_fname||":"||evaluated_line 
    +      msg ||:= "\n   Ended at file "||evaluated_fname||":"||evaluated_line
           msg ||:= "\n   Its location was hit "||location||" times."
           DState.Write(msg)
           }
    @@ -2088,7 +2088,7 @@ method checkEvaluation()
           evalValue := FALSE
           msg   := "\n   Assertion #"||id||" at "||fname||","||line||": "||strCmd
           msg ||:= ": (Failed "||part2_CountTrue||" out of "||x||")."
    -      msg ||:= "\n   Ended at file "||evaluated_fname||":"||evaluated_line 
    +      msg ||:= "\n   Ended at file "||evaluated_fname||":"||evaluated_line
           msg ||:= "\n   Its location was hit "||location||" times."
           DState.Write(msg)
           }
    @@ -2107,7 +2107,7 @@ initially(DebugState, Pname, Fname, Line, Code, Body, ID)
        kind             := FUTURE_TIME_ASSERT
        triggered        := FALSE
        pre_triggered    := FALSE
    - 
    +
        eventMask        := cset(E_Line)
        self.Assertion.initially(DebugState, Pname, Fname, Line, Code, Body, ID)
     end
    diff --git a/uni/udb/evaluator.icn b/uni/udb/evaluator.icn
    index f2ec0fa6c..e54f32d5a 100644
    --- a/uni/udb/evaluator.icn
    +++ b/uni/udb/evaluator.icn
    @@ -1,7 +1,7 @@
     #
     # evaluator.icn: Handles the main Runtime Monitoring facilities
    -# Author:	 Ziad Al-Sharif, zsharif@gmail.com
    -# Contributor:	 Gigi Young
    +# Author:        Ziad Al-Sharif, zsharif@gmail.com
    +# Contributor:   Gigi Young
     #
     
     $include "evdefs.icn"
    @@ -18,11 +18,11 @@ global ESource
     global es_flag # eventsource flag (OWN | MONITORED)
     
     #
    -# Contains the core of the udb debugging facilities 
    +# Contains the core of the udb debugging facilities
     #
     class Evaluator(
    -   Break,       # An object of the BreakPoint() class 
    -   Watch,       # An object of the WatchkPoint() class 
    +   Break,       # An object of the BreakPoint() class
    +   Watch,       # An object of the WatchkPoint() class
        Frame,       # An object of the Stack() class
        Print,       # An object of the Data() class
        Step,        # An object of the Stepping() class
    @@ -31,15 +31,15 @@ class Evaluator(
        External,    # An object of the Externals() class
        DTA,         # an object of the TempAssert() class
        DState,      # An object of the State() class
    -   
    -   BuiltIns,    # A table that maps eventcodes to their methods 
    -   
    +
    +   BuiltIns,    # A table that maps eventcodes to their methods
    +
        Message      # a string formated with the current message
        )
     
     #
     # This was adapted from the evaltree.icn unicon library
    -# for the needs of the udb debugging facilities. 
    +# for the needs of the udb debugging facilities.
     #
     method startEvaluator()
        local obj, eventMask, valueMask
    @@ -52,7 +52,7 @@ method startEvaluator()
               if *DState.breakMask > 0  then { Break.checkBreakpoint() }
               if DState.RunCode = NEXT  then { Step.checkNext()        }
               if DState.RunCode = STEP  then { Step.checkStep()        }
    -          if DState.RunCode = PSTEP then { Step.checkStep()        }  
    +          if DState.RunCode = PSTEP then { Step.checkStep()        }
               }
             E_Assign | E_Value: {
               # check for Watch point on changed vars & keywords
    @@ -75,26 +75,26 @@ method startEvaluator()
                                     Step.handle_PatStack() }
     
             # Coexp created, add to list of coexps
    -        E_CoCreate: { 
    +        E_CoCreate: {
                # parent is current coexp
                DState.addCoexp(&eventvalue)
                #DState.coState.add_coexp(&eventvalue,DState.coState.get_curr())
                }
     
             # Coexp activated, set current coexp to value
    -        E_Coact: { 
    +        E_Coact: {
                DState.updateCoState(&eventvalue)
                write("[Activating co-expression ",DState.coState.curr.id,"]")
                }
             # Coexp failed to produce result, remove from list of coexps
    -        E_Cofail: { 
    +        E_Cofail: {
                write("[Co-expression ",DState.coState.curr.id," failed]")
                DState.removeCoexp()
                DState.updateCoState(&eventvalue)
                write("[Returning to co-expression ",DState.coState.curr.id,"]")
                }
             # Coexp returned, set current coexp to value
    -        E_Coret: { 
    +        E_Coret: {
                DState.updateCoState(&eventvalue)
                write("[Returning to co-expression ",DState.coState.curr.id,"]")
                }
    @@ -104,20 +104,20 @@ method startEvaluator()
             E_Signal:             { handle_Signals()  }
             } # end of case ecode
     
    -      # Tracing Features 
    +      # Tracing Features
           if *DState.traceMask > 0 then{
    -         if member(DState.traceMask, &eventcode) then 
    +         if member(DState.traceMask, &eventcode) then
                 Trace.checkTraceBehavior()
              }
     
    -      # Internal Extension Agents 
    +      # Internal Extension Agents
           if Internal.enabled > 0 then{
    -         every obj := !Internal.activeClients do 
    -            if member(obj.eventMask, &eventcode) then 
    +         every obj := !Internal.activeClients do
    +            if member(obj.eventMask, &eventcode) then
                    obj.Forward()
              }
     
    -      # External Extension Agents  
    +      # External Extension Agents
           if External.enabled > 0 then
              External.Forward()
     
    @@ -126,8 +126,8 @@ method startEvaluator()
     
           if DState.State = PAUSE then
              suspend
    -      else if DState.State = END then 
    -         return 
    +      else if DState.State = END then
    +         return
           }
     end
     
    @@ -192,7 +192,7 @@ method initEvaluator()
        BuiltIns[E_Value]  := self.__s.Watch.__m.checkWatchChange
     
        #Evaluator_handle_WatchRead
    -   BuiltIns[E_Deref]  := self.__s.Watch.__m.checkWatchRead 
    +   BuiltIns[E_Deref]  := self.__s.Watch.__m.checkWatchRead
     
        #Evaluator_handle_StringScanning
        BuiltIns[E_Spos]   := self.__s.Watch.__m.checkWatchScan
    @@ -216,7 +216,7 @@ initially()
        Print    := Data()          # The printing techbiques
        Step     := Stepping()      # The stepping and continuing Techniques
        Trace    := Tracing()       # The Dynamic Tracing Techniques
    -   Internal := Internals()     # The Internal monitors and/or visualizers 
    +   Internal := Internals()     # The Internal monitors and/or visualizers
        External := Externals()     # The External monitors with co-expression switch
        DTA      := TempAssert()    # The Dynamic Temporal Assertions
     
    diff --git a/uni/udb/help.icn b/uni/udb/help.icn
    index 94c9010b9..a6b3f073f 100644
    --- a/uni/udb/help.icn
    +++ b/uni/udb/help.icn
    @@ -3,7 +3,7 @@
     # Author:      Ziad Al-Sharif, zsharif@gmail.com
     # Contributor: Gigi Young
     #
    - 
    +
     $include "defaults.icn"
     
     
    @@ -34,7 +34,7 @@ class HELP(
        Message
        )
     
    -#         
    +#
     # General Help Command
     #
     method cmdHelp(cmd)
    @@ -51,15 +51,15 @@ method cmdHelp(cmd)
         ERROR:{
           Message := errorState||cmdClasses||assistance
           }
    -   }# end of case   
    +   }# end of case
        }
        else{
        case cmd[2] of {
        "all":{
            Message := basic || breakpoints ||watchpoints || tracepoints ||
    -	   stack || stepping || data || files || memory || shell ||
    -	   assertions || extensions ||
    -	   assistance
    +           stack || stepping || data || files || memory || shell ||
    +           assertions || extensions ||
    +           assistance
         }
        "basic":{
         Message := basic
    @@ -212,7 +212,7 @@ method cmdHelp(cmd)
         \n   Sets a watchpoint on some variable._
         \n   watch          : Prints a list of all pre-set watch variables._
         \n   watch var      : Break at every line the (var) can change._
    -    \n                    If the program is running, it watches for_ 
    +    \n                    If the program is running, it watches for_
         \n                    (var) in the local scope, otherwise it_
         \n                    assumes that (var) is a global variable._
         \n   watch var proc : Watch for local (var) in procedure (proc)."
    @@ -298,18 +298,18 @@ method cmdHelp(cmd)
         }
        default:{
         Message:="\n   Command not found. Type \"help\" for assistance"
    -    } 
    +    }
        }#end of case
        }# end of else
    -   #make udb console takes no actions 
    +   #make udb console takes no actions
        DState.State := SKIP
        DState.Write(Message)
     end
     
     initially()
     
    -   cmdClasses := "_ 
    -    \n_   
    +   cmdClasses := "_
    +    \n_
         \n   Command classes:_
         \n   basic       : Common essential commands._
         \n   breakpoints : How to pause the program at source code locations._
    @@ -401,7 +401,7 @@ initially()
     
        coexp := "_
         \n   coexp n     : Changes the viewed co-expression to (coexp n)._
    -    \n   coexp       | _ 
    +    \n   coexp       | _
         \n   info coexp  : Lists the currently activated co-expressions of_
         \n                 the program._
         \n _
    @@ -467,52 +467,52 @@ initially()
         \n     the first [count] number of incidents. If [count] is provided and _
         \n     count < 0, the user is able to trace back the last [count] number of_
         \n     incidents’ locations and values._
    -    \n_  
    +    \n_
         \n   watch [–silent] var: Silently watches (var) whenever assigned._
         \n   watch [n] var  : Watches var's first (n) number of assignments._
         \n   watch [-n] var : Watches var's values and tracks its last n'th value._
         \n   watch var = val  : Watches (var) whenever assigned with value._
         \n   watch var > val  : Watches (var) whenever assigned with a value > val._
         \n   watch –s n var   : Silently watches var's first n assignments._
    -    \n_  
    +    \n_
         \n   rwatch [–silent] [count] variable [[=|>|<|<=|>=|~=] value]_
         \n     Sets a watchpoint on variable whenever read. Other arguments are_
         \n     similar to the watch command._
    -    \n_  
    +    \n_
         \n   vwatch [–silent] [count] variable [[=|>|<|<=|>=|~=] value]_
         \n     Sets a watchpoint on variable whenever assigned and the new value_
         \n     is different from the old one (changed value). Other arguments are_
         \n     similar to the watch command._
    -    \n_  
    +    \n_
         \n   twatch [–silent] [count] variable [[=|~=] type ]_
         \n     Sets a watchpoint on variable whenever assigned and the type of new_
         \n     value is different from the type of the old one (changed type)._
         \n     Other arguments are similar to the watch command._
    -    \n_  
    +    \n_
         \n   swatch [–silent][count]_
         \n     Sets a watchpoint on string scanning environment; in particular the_
         \n     explicit and implicit change of &pos and &subject keywords._
    -    \n_  
    +    \n_
         \n   info watchpoints : Shows a complete list of all watchpoints._
         \n              info awatch, info rwatch, info vwatch, or info twatch,_
         \n              each shows a list of the specified type of watchpoints._
    -    \n_  
    +    \n_
         \n   clear watchpoints: Clears all watchpoints regardless of their type._
         \n              clear awatch, clear rwatch, clear twatch, clear vwatch, or_
         \n              clear swatch, clears only the specified type of watchpoints._
    -    \n_  
    +    \n_
         \n   delete watchpoints : Deletes all watchpoints._
         \n              delete awatch, delete rwatch, delete twatch, delete vwatch,_
         \n              or delete swatch, each deletes only the specified type of_
         \n              watchpoints._
         \n   delete watch [n]   : Deletes the watchpoint with the id number [n]._
    -    \n_  
    +    \n_
         \n   enable watchpoints : Enables all disabled watchpoints._
         \n              enable awatch, enable rwatch, enable twatch, enable vwatch,_
         \n              or enable swatch, each enables only the specified_
         \n              type of watchpoints_
         \n   enable watch [n]   : Enables the watchpoint with the id number [n]_
    -    \n_  
    +    \n_
         \n   disable watchpoints: Disables all watchpoints._
         \n              disable awatch, disable rwatch, disable twatch,_
         \n              disable vwatch, or disable swatch, disable_
    @@ -528,7 +528,7 @@ initially()
         \n     the first [count] number of incidents. If [count] is provided and _
         \n     count < 0, the user is able to trace back the last count number_
         \n     of incidents._
    -    \n_  
    +    \n_
         \n   trace p        : Traces all valid behaviors of the procedure (p)._
         \n   trace p call   : Traces whenever (p) is called. This action_
         \n                    is very similar to the break bar command._
    @@ -536,7 +536,7 @@ initially()
         \n   trace p return <= 1 : Traces whenever (p) returns a value <= 1._
         \n   trace 10 p resume   : Traces the first 10 times that (p) is resumed._
         \n   trace p fail        : Traces whenever (p) fails._
    -    \n_   
    +    \n_
         \n   trace –silent p   : Silently traces all valid behaviors of (p)._
         \n_
         \n   trace [–silent] [count] function [behavior [op value]]_
    @@ -546,13 +546,13 @@ initially()
         \n   trace p call        : Traces whenever p() is called._
         \n   trace p fail      : Traces whenever p() fails._
         \n   trace p return < 0  : Traces whenever p() returns a value < 0._
    -    \n_  
    +    \n_
         \n   trace [–silent] [count] operator [behavior [op value]]_
         \n     Sets a tracepoint on a built-in operator whenever the specified_
         \n     behavior is satisfied. If behavior is not provided, all behaviors_
         \n     are traced. operator is one of the following: (+, -, *, /, \, =,_
         \n     ~=, ==, ~==, ===, ~===, <, <=, <<=, >, >=, >>=, ++, --, **,!,?,[])_
    -    \n_  
    +    \n_
         \n   trace [] fail      : Traces whenever the [] (subscript) operator fails._
         \n   trace ! suspend    : Traces whenever the ! (apply) operator suspends._
         \n   trace = fail       : Traces whenever the = operator fails._
    @@ -560,7 +560,7 @@ initially()
         \n   trace ~== return   : Traces whenever the ~== returns (succeeds)._
         \n   trace ~== return = “ab” : Traces the ~== whenever it returns and_
         \n                        the right side is lexically equal to “ab”_
    -    \n_  
    +    \n_
         \n   info tracepoints   : Prints a complete list of all tracepoints._
         \n   info trace [n]     : Prints info about the tracepoint with id [n]._
         \n   info trace [name]  : Prints info about the tracepoint on [name]._
    @@ -586,14 +586,14 @@ initially()
         \n              If [n] is provided, it prints the nth innermost frames_
         \n              when n>0, and the nth outermost frames when_
         \n              n < 0. The where and bt commands are aliases._
    -    \n_   
    +    \n_
         \n   frame [n]: Selects and displays information of frame number [n]._
         \n              If [n] is not provided, it displays information about_
         \n              the currently selected frame. f [n] is an alias_
    -    \n_  
    +    \n_
         \n   up [n]   : Moves the selected frame [n] frames up; if [n] is not_
         \n              provided, it moves the currently frame one frame up_
    -    \n_   
    +    \n_
         \n   down [n] : Moves the selected frame [n] frames down; if [n] is not_
         \n               provided, it moves the currently frame one frame down"
     
    @@ -603,7 +603,7 @@ initially()
         \n                 if [count] is specified, it repeats the command count_
         \n                 more times. s and s [count] are aliases._
         \n   next [count]: Executes the next line and steps over any procedure call._
    -    \n                 If [count] is specified, it repeats the command [count]_ 
    +    \n                 If [count] is specified, it repeats the command [count]_
         \n                 more times. n and n [count] are aliases._
         \n   return      : Completes the execution of the current procedure and_
         \n                 returns back to the place of calling to step on the next_
    @@ -612,9 +612,9 @@ initially()
         \n   print var : Prints the value of (var); if variable is a reference to_
         \n               a structure, then it displays its ximage, otherwise it_
         \n               displays its simple value. p is an alias._
    -    \n_  
    +    \n_
         \n   print &keyword : Prints the value of &keyword; i.e. print &pos_
    -    \n_  
    +    \n_
         \n   print expr: Prints the evaluation of (expr). i.e._
         \n               p L[5]    : prints the contents of L[5]._
         \n               p S[i:10] : prints the characters between i and 10 of S._
    @@ -624,7 +624,7 @@ initially()
         \n                     print x = 10, print L[1] = 1000, print S[4] = \“K\”,_
         \n                     p T[\“one\”]=\“1\”, p S[5:10]=\“insert a string\”_
         \n                     p r.a = 4.5, p x = y; where y is another variable._
    -    \n_  
    +    \n_
         \n   print &keyword = val: Assigns a val to a &keyword;_
         \n                         i.e. p &pos = 1, p &subject = \“ABCcba\”_
         \n_
    @@ -648,7 +648,7 @@ initially()
         \n   info dir  | _
         \n   show dir  : Prints the source path._
          "
    - 
    +
        files := "_
         \n   list          : Displays ten lines of source code. If execution is_
         \n                   paused,the printed lines are from the current line_
    @@ -663,7 +663,7 @@ initially()
         \n                   of the file. i.e. l -25: shows ten lines surrounding_
         \n                   the line number 25 counting backward from the end_
         \n                   of file_
    -    \n_  
    +    \n_
         \n   info source   : Prints a detailed summary about the loaded executable._
         \n   info file     : Prints a list of all source files in use including_
         \n                   library files._
    @@ -704,12 +704,12 @@ initially()
         \n   -----Internals ------------------------------------------------------_
         \n   enable internal agent : Enables the internal agent named agent._
         \n   disable internal agent: Disables the internal agent named agent._
    -    \n_  
    +    \n_
         \n   info internal         : Prints information about all internal agents_
         \n                           available in the session and the system._
         \n   info internal agent   : Prints information about the specific internal_
         \n                           agents named agent._
    -    \n_  
    +    \n_
         \n   -----Externals ------------------------------------------------------_
         \n   load –agent agent     : Loads a standalone external agent named agent_
         \n                           on the fly during the debugging session._
    diff --git a/uni/udb/icode.icn b/uni/udb/icode.icn
    index 7702fb66e..bd88894bf 100644
    --- a/uni/udb/icode.icn
    +++ b/uni/udb/icode.icn
    @@ -16,7 +16,7 @@ $endif
     record header (
        hsize,    # /* size of interpreter code          */
        trace,    # /* initial value of &trace           */
    -   Records,  # 
    +   Records,  #
        Ftab,     # /* location of record/field table    */
        Fnames,   # /* location of names of fields       */
        Globals,  # /* location of global variables      */
    @@ -44,7 +44,7 @@ class Icode(
        hdr,          # An instance of the header() record
        IntBits,      # number of bits in an integer
        WordBits,     # number of bits in a unicon word
    -   wordSize,     # 4 on a 32-bit and 8 on a 64-bit machine 
    +   wordSize,     # 4 on a 32-bit and 8 on a 64-bit machine
        FTC,          # a flag; when it is not null, it holds FT from icode v
        icodeVersion  # String holds the Icode Version 32/64 compressed/uncompressed
        )
    @@ -104,7 +104,7 @@ end
     #end
     
     #
    -# checks the accessability of the executable and reads the icode 
    +# checks the accessability of the executable and reads the icode
     #
     method openIcodeFile(exeFile)
        local statrec, f
    @@ -116,7 +116,7 @@ method openIcodeFile(exeFile)
           fail
           }
     
    -   # reads all of the executable into the icode 
    +   # reads all of the executable into the icode
        icode := reads(f, statrec.size)
        close(f)
     
    @@ -160,16 +160,16 @@ end
     #
     method printIcodeHeader()
        local fn
    -   
    +
        write("   Icode Version   : " || icodeVersion)
        every fn := fieldnames(hdr) do
            if fn ~=="config" then
    -          write("   header.", left(fn,8," "), " = ", image(hdr[fn])) 
    +          write("   header.", left(fn,8," "), " = ", image(hdr[fn]))
     end
     
     #
     # Icode Version depends on the size of the Unicon word,
    -# 4-bytes on a 32-bit machine or 8-bytes on a 64-bit machine 
    +# 4-bytes on a 32-bit machine or 8-bytes on a 64-bit machine
     #
     method checkIcodeVersion(p)
     
    @@ -199,8 +199,8 @@ method checkIcodeVersion(p)
              readIcodeHeader()
           }
           else if not match("I12.U",hdr.config) then
    -	 write("Warning: did not recognize icode version:\n",
    -	       image(hdr.config))
    +         write("Warning: did not recognize icode version:\n",
    +               image(hdr.config))
     
           icodeVersion := "64-bit"
           }
    @@ -216,7 +216,7 @@ end
     method readCompressedIcode()
        local ftmp
     
    -   # we need to uncompress the rest brute force means: 
    +   # we need to uncompress the rest brute force means:
        # write it out and then read it in an uncompress mode
        ftmp := open("tmpfilename","w") |  stop("cannot open a tmpfilename")
        writes(ftmp, tab(0))
    @@ -227,12 +227,12 @@ method readCompressedIcode()
                       stop("can't read compressed icode")
           close(ftmp)
           }
    -   else 
    +   else
           stop("cannot open a tmpfilename")
     end
     
     #
    -# I code will be in a compressed format if it exceeds the 1 MB limit 
    +# I code will be in a compressed format if it exceeds the 1 MB limit
     #
     method checkCompressedIcode()
        local Z, size
    @@ -241,9 +241,9 @@ method checkCompressedIcode()
        hdr.config ? {
           tab(find("/")+1) | stop("can't find /")
           IntBits := size := integer(tab(many(&digits)))# tabs the IntBits
    -      move(1)                                       # moves over the / 
    +      move(1)                                       # moves over the /
           WordBits := integer(tab(many(&digits)))       # tabs the WordBits
    -      Z := move(1)                                  # get the Z letter 
    +      Z := move(1)                                  # get the Z letter
           }
     
        if Z == "Z" then {
    diff --git a/uni/udb/lib/counter_deref.icn b/uni/udb/lib/counter_deref.icn
    index 9cff6527d..7e346a077 100644
    --- a/uni/udb/lib/counter_deref.icn
    +++ b/uni/udb/lib/counter_deref.icn
    @@ -35,7 +35,7 @@ end
     #
     # StandAlone is defined when this tool is used as a stand-alone monitor.
     #  Otherwise, this tool can be statically linked into the main utop/udb
    -#  source code 
    +#  source code
     #
     $ifdef StandAlone
     
    @@ -44,7 +44,7 @@ link evinit
     #
     # This main procedure is only used in the standalone mode
     # or udb's external co-expression mode
    -# 
    +#
     procedure main(tp)
         local mask, obj
     
    @@ -54,34 +54,34 @@ procedure main(tp)
         mask := obj.eventMask
     
         while EvGet(mask) do{
    -	if &eventcode == E_Deref then
    -	    obj.handle_E_Deref()
    -	else 
    -	    obj.handle_E_Exit()
    +        if &eventcode == E_Deref then
    +            obj.handle_E_Deref()
    +        else
    +            obj.handle_E_Exit()
         }
         return 0
         handle_Events()
     end
     
     #
    -# This handle_Events procedure is only used udb's external 
    +# This handle_Events procedure is only used udb's external
     # inter-program procedure calls
     #
     procedure handle_Events(code, value)
        static obj
    -   
    +
        initial{
    -      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")   
    +      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")
           obj := EventCounterDeref()
           return obj.eventMask
    -      } 
    +      }
     
        &eventcode  := code
        &eventvalue := value
     
        if &eventcode == E_Deref then
           obj.handle_E_Deref()
    -   else 
    +   else
           obj.handle_E_Exit()
        return
     end
    diff --git a/uni/udb/lib/counter_line.icn b/uni/udb/lib/counter_line.icn
    index c467f2198..50375c50d 100644
    --- a/uni/udb/lib/counter_line.icn
    +++ b/uni/udb/lib/counter_line.icn
    @@ -35,7 +35,7 @@ end
     #
     # StandAlone is defined when this tool is used as a stand-alone monitor.
     #  Otherwise, this tool can be statically linked into the main utop/udb
    -#  source code 
    +#  source code
     #
     $ifdef StandAlone
     
    @@ -44,7 +44,7 @@ link evinit
     #
     # This main procedure is only used in the standalone mode
     # or udb's external co-expression mode
    -# 
    +#
     procedure main(tp)
         local mask, obj
     
    @@ -54,34 +54,34 @@ procedure main(tp)
         mask := obj.eventMask
     
         while EvGet(mask) do{
    -	if &eventcode == E_Line then
    -	    obj.handle_E_Line()
    -	else 
    -	    obj.handle_E_Exit()
    +        if &eventcode == E_Line then
    +            obj.handle_E_Line()
    +        else
    +            obj.handle_E_Exit()
         }
         return 0
         handle_Events()
     end
     
     #
    -# This handle_Events procedure is only used udb's external 
    +# This handle_Events procedure is only used udb's external
     # inter-program procedure calls
     #
     procedure handle_Events(code, value)
        static obj
    -   
    +
        initial{
    -      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")   
    +      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")
           obj := EventCounterLine()
           return obj.eventMask
    -      } 
    +      }
     
        &eventcode  := code
        &eventvalue := value
     
        if &eventcode == E_Line then
           obj.handle_E_Line()
    -   else 
    +   else
           obj.handle_E_Exit()
        return
     end
    diff --git a/uni/udb/lib/counter_pcall.icn b/uni/udb/lib/counter_pcall.icn
    index 8182808f8..7fb596990 100644
    --- a/uni/udb/lib/counter_pcall.icn
    +++ b/uni/udb/lib/counter_pcall.icn
    @@ -35,7 +35,7 @@ end
     #
     # StandAlone is defined when this tool is used as a stand-alone monitor.
     #  Otherwise, this tool can be statically linked into the main utop/udb
    -#  source code 
    +#  source code
     #
     $ifdef StandAlone
     
    @@ -44,7 +44,7 @@ link evinit
     #
     # This main procedure is only used in the standalone mode
     # or udb's external co-expression mode
    -# 
    +#
     procedure main(tp)
         local mask, obj
     
    @@ -54,34 +54,34 @@ procedure main(tp)
         mask := obj.eventMask
     
         while EvGet(mask) do{
    -	if &eventcode == E_Pcall then
    -	    obj.handle_E_Pcall()
    -	else 
    -	    obj.handle_E_Exit()
    +        if &eventcode == E_Pcall then
    +            obj.handle_E_Pcall()
    +        else
    +            obj.handle_E_Exit()
         }
         return 0
         handle_Events()
     end
     
     #
    -# This handle_Events procedure is only used udb's external 
    +# This handle_Events procedure is only used udb's external
     # inter-program procedure calls
     #
     procedure handle_Events(code, value)
        static obj
    -   
    +
        initial{
    -      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")   
    +      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")
           obj := EventCounterPcall()
           return obj.eventMask
    -      } 
    +      }
     
        &eventcode  := code
        &eventvalue := value
     
        if &eventcode == E_Pcall then
           obj.handle_E_Pcall()
    -   else 
    +   else
           obj.handle_E_Exit()
        return
     end
    diff --git a/uni/udb/lib/counter_syntax.icn b/uni/udb/lib/counter_syntax.icn
    index 68ee2e40c..5eb2fa7dd 100644
    --- a/uni/udb/lib/counter_syntax.icn
    +++ b/uni/udb/lib/counter_syntax.icn
    @@ -35,7 +35,7 @@ end
     #
     # StandAlone is defined when this tool is used as a stand-alone monitor.
     #  Otherwise, this tool can be statically linked into the main utop/udb
    -#  source code 
    +#  source code
     #
     $ifdef StandAlone
     
    @@ -44,7 +44,7 @@ link evinit
     #
     # This main procedure is only used in the standalone mode
     # or udb's external co-expression mode
    -# 
    +#
     procedure main(tp)
         local mask, obj
     
    @@ -54,34 +54,34 @@ procedure main(tp)
         mask := obj.eventMask
     
         while EvGet(mask) do{
    -	if &eventcode == E_Syntax then
    -	    obj.handle_E_Syntax()
    -	else 
    -	    obj.handle_E_Exit()
    +        if &eventcode == E_Syntax then
    +            obj.handle_E_Syntax()
    +        else
    +            obj.handle_E_Exit()
         }
         return 0
         handle_Events()
     end
     
     #
    -# This handle_Events procedure is only used udb's external 
    +# This handle_Events procedure is only used udb's external
     # inter-program procedure calls
     #
     procedure handle_Events(code, value)
        static obj
    -   
    +
        initial{
    -      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")   
    +      #EvInit(arg) | stop(" **** can not initialize Monitor !!!")
           obj := EventCounterSyntax()
           return obj.eventMask
    -      } 
    +      }
     
        &eventcode  := code
        &eventvalue := value
     
        if &eventcode == E_Syntax then
           obj.handle_E_Syntax()
    -   else 
    +   else
           obj.handle_E_Exit()
        return
     end
    diff --git a/uni/udb/session.icn b/uni/udb/session.icn
    index 817492800..9c24f2f35 100644
    --- a/uni/udb/session.icn
    +++ b/uni/udb/session.icn
    @@ -8,13 +8,13 @@ $include "evdefs.icn"
     $include "defaults.icn"
     
     #
    -# This class is used to handle the current debugging state 
    +# This class is used to handle the current debugging state
     #
     class Session(
        DState,       # an object of the class State()
        Help,         # an object of the class HELP()
        Message,      # the formatted output message
    -   Debug         # An object of the class Evaluator() 
    +   Debug         # An object of the class Evaluator()
        )
     
     #
    @@ -26,7 +26,7 @@ method startSession()
     
        #-- it may need to be in EvInit() for the sake of re-run
        &eventsource := &null
    -   
    +
        if \DState.mode == "-adapter" then
           EvInit(DState.TP, DState.progSock, DState.progSock, DState.progSock) | { failed := "__true__" }
        else
    @@ -37,7 +37,7 @@ method startSession()
           declare_exit("cant start evinit on " || DState.TP[1], 1)
           fail
        }
    -   
    +
        Message :="   Starting program: "
        every arg := !DState.TP do Message ||:=" "||arg
        Message ||:="\n"
    @@ -69,7 +69,7 @@ method startSession()
                 # forcefully quit program to load
                 return
                 }
    -      }#end every 
    +      }#end every
        }
        #--- Test
        #write("====================================")
    @@ -100,8 +100,8 @@ method parse_Command(cmd)
          "run"    :{  cmdRun(cmd)                       }
          "q"      |
          "quit"   :{
    -	write(&errout, "received ", image(cmd[1]), ", quitting")
    -	cmdQuit()                         }
    +        write(&errout, "received ", image(cmd[1]), ", quitting")
    +        cmdQuit()                         }
          "p"      |
          "print"  :{  cmdPrint(cmd[2:0])                }
          "b"      |
    @@ -142,9 +142,9 @@ method parse_Command(cmd)
          "enable" :{  cmdEnable(cmd)                    }
          "disable":{  cmdDisable(cmd)                   }
     
    -     "coexp"  :{ cmdCoexp(cmd)                      } 
    +     "coexp"  :{ cmdCoexp(cmd)                      }
          "directory"|
    -     "dir"    :{ DState.srcFile.cmdDirectory(cmd)   } 
    +     "dir"    :{ DState.srcFile.cmdDirectory(cmd)   }
          "show"   :{ cmdShow(cmd)                       }
          # Temporal Assertions support
          "assert" :{  Debug.DTA.cmdAssert(cmd)          }
    @@ -158,7 +158,7 @@ method parse_Command(cmd)
          "ls"|"ll":{ ls()     }
          "pwd"    :{ pwd()    }
          "cd"     :{ cd(cmd)  }
    -     #-new set of commands for the UDB config script 
    +     #-new set of commands for the UDB config script
          "loadscript" :{ }
          "runscript"  :{ }
          "#"  :{ }
    @@ -173,11 +173,11 @@ method parse_Command(cmd)
     end
     
     #
    -# Loads a file after running the UDB Session 
    +# Loads a file after running the UDB Session
     # or loads an external monitor: load -external name
     #
     method cmdLoad(cmd)
    -   
    +
        if cmd[2][1] == "-" then{
           #load -agent name
           if find("agent", cmd[2]) & \cmd[3] then{
    @@ -191,8 +191,8 @@ method cmdLoad(cmd)
                 Message := "\n   Can not fined agent: \""|| cmd[3] ||"\" !!!."
                 DState.Write(Message)
                 }
    -         } 
    -      #load -semi-internal name 
    +         }
    +      #load -semi-internal name
           else if find("semi-internal", cmd[2]) & \cmd[3] then
              Debug.SemiInternal.cmdLoad(cmd[3])
           else{
    @@ -219,9 +219,9 @@ end
     method cmdRun(cmd)
        local i, ans, args
        local resultTable := table()
    -     
    +
        if DState.State = (LOAD | END | PAUSE) then {
    -      # run - use args from 'load' 
    +      # run - use args from 'load'
           if *cmd = 1 then {
              args := DState.TP
           }
    @@ -231,7 +231,7 @@ method cmdRun(cmd)
              every i:=2 to *cmd do put(args, cmd[i])
           }
           DState.TP := args
    - 
    +
           if DState.State = PAUSE then{
              Message  :="\n   The program being debugged has been started already."
              Message||:="\n   Start it from the beginning? (Y/n)?: "
    @@ -243,19 +243,19 @@ method cmdRun(cmd)
                 Debug.Watch.resetWatchInfo()
                 Debug.Trace.resetTraceInfo()
                 DState.Update(RERUN)
    -         } 
    +         }
              else{
                 DState.State := SKIP
                 return
              }
    -      } 
    +      }
           # run (like normal)
           else {
              DState.Update(RUN)
              if DState.RunCount >= 1 then{
                 Debug.Watch.resetWatchInfo()
                 Debug.Trace.resetTraceInfo()
    -         }             
    +         }
           }
        }
        else {
    @@ -278,7 +278,7 @@ method cmdQuit()
        # check whether a program is running or not, Paused, etc??????
        # do not exit directlly if the program is in the running state
        if DState.State = (RUN | PAUSE) then{
    -      msg := "\n   The program \""|| 
    +      msg := "\n   The program \""||
                               DState.srcFile.exeName ||
                               "\" is running.  Exit anyhow (Y/n)?: "
           resultTable["consoleMsg"] := msg
    @@ -286,7 +286,7 @@ method cmdQuit()
           DState.Writes(resultTable)
           if (not (ans:=DState.stateRead())) | (*ans=0) | (map(ans[1]) == "y") then {
              DState.State := QUIT
    -	 }
    +         }
           else
              DState.State := SKIP
           }
    @@ -319,7 +319,7 @@ method cmdPrint(cmd)
     end
     
     #
    -# clears breakpoints, watchpoints, and tracepoints 
    +# clears breakpoints, watchpoints, and tracepoints
     #
     method cmdClear(cmd)
     
    @@ -358,7 +358,7 @@ else{
     end
     
     #
    -# deletes breakpoints, watchpoints, and tracepoints 
    +# deletes breakpoints, watchpoints, and tracepoints
     #
     method cmdDelete(cmd)
     
    @@ -478,7 +478,7 @@ end
     # Allows switching between different co-expressions
     #
     method cmdCoexp(cmd)
    -   # coexp 
    +   # coexp
        if *cmd = 1 then {
           DState.printCoState()
           }
    @@ -532,7 +532,7 @@ method cmdInfo(cmd)
           "trace"      |
           #"watchpoint" |
           "tracepoints":{ Debug.Trace.printTraceInfo(cmd)        }
    -      "coexp"      :{ cmdInfoCoexp(cmd)                     } 
    +      "coexp"      :{ cmdInfoCoexp(cmd)                     }
           # The following are for source code information
           "global"     :{ Debug.Print.cmdPrint(["p","-g"])       }
           "local"      :{ Debug.Print.cmdPrint(["p","-l"])       }
    @@ -555,17 +555,17 @@ method cmdInfo(cmd)
           "procedure"  :{ Debug.Print.cmdSource(["src","-proc"]) }
           "func"       |
           "function"   :{ Debug.Print.cmdSource(["src","-func"]) }
    -       
    +
           "icode"      :{ Debug.Print.cmdSource(["src","-icode"])}
           "dir"        |
           "directory"  |
    -      "directories":{ DState.srcFile.cmdShowDir(cmd) } 
    +      "directories":{ DState.srcFile.cmdShowDir(cmd) }
     
           # the following is to query about agents
    -      "agent"      |      
    +      "agent"      |
           "agents"     :{ Debug.Internal.cmdInfo(name)
                           Debug.External.cmdInfo(name)           }
    -      "internal"   |      
    +      "internal"   |
           "internals"  :{ Debug.Internal.cmdInfo(name)           }
           "external"   |
           "externals"  :{ Debug.External.cmdInfo(name)           }
    @@ -581,13 +581,13 @@ method cmdInfo(cmd)
           }
     end
     
    -method cmdShow(cmd) 
    +method cmdShow(cmd)
        if *cmd = 2 then {
           case cmd[2] of {
              "directories"|
              "directory"|
              "dir" : { DState.srcFile.cmdShowDir(cmd) }
    -         default: { 
    +         default: {
                 DState.State := ERROR
                 Message := "\n   Undefined Command: \""||DState.cmdHistory[1]||
                            "\""||
    @@ -633,16 +633,16 @@ initially()
        Debug  := Evaluator()
        Help   := HELP()
     
    -   DState := Help.DState            := 
    -             Debug.DState           := 
    -             Debug.Break.DState     := 
    -             Debug.Watch.DState     := 
    -             Debug.Step.DState      := 
    -             Debug.Frame.DState     := 
    -             Debug.Print.DState     := 
    -             Debug.Trace.DState     := 
    -             Debug.Internal.DState  := 
    -             Debug.External.DState  := 
    +   DState := Help.DState            :=
    +             Debug.DState           :=
    +             Debug.Break.DState     :=
    +             Debug.Watch.DState     :=
    +             Debug.Step.DState      :=
    +             Debug.Frame.DState     :=
    +             Debug.Print.DState     :=
    +             Debug.Trace.DState     :=
    +             Debug.Internal.DState  :=
    +             Debug.External.DState  :=
                  Debug.DTA.DState       := State()
     
     # Test : To test the inter-program event forwarding
    diff --git a/uni/udb/stack.icn b/uni/udb/stack.icn
    index 5c294c031..fd5a56fb2 100644
    --- a/uni/udb/stack.icn
    +++ b/uni/udb/stack.icn
    @@ -11,7 +11,7 @@ class Stack(
        DState,     # (Alias) object of type State class
        MaxFrame,   # the max number of frames displayed in one command [bt & where]
        BaseFrame,  # the initial frame number by default is zero [bt & where]
    -   Message     # a string with latest message from this class 
    +   Message     # a string with latest message from this class
        )
     
     method getLevel(C)
    @@ -28,7 +28,7 @@ method getLevel(C)
     end
     
     #
    -# writes down the current frame information, 
    +# writes down the current frame information,
     # used by cmdPrint, cmdFrame, cmdUp, cmdDown
     #
     method printFrame(frame, detail:1)
    @@ -74,7 +74,7 @@ method printFrame(frame, detail:1)
           else{
              pfile ||:= keyword("file", CMonitored, frame)
              #DState.srcFile.getProcFile(pname) | "?"
    -         pline ||:= keyword("line", CMonitored, frame) 
    +         pline ||:= keyword("line", CMonitored, frame)
              #DState.srcFile.getProcLine(pname,pfile) | "?"
              }
           Message ||:= " at "|| pfile ||":"||pline
    @@ -104,7 +104,7 @@ end
     #
     method printFrames(i, j)
        local f, level, CMonitored := DState.coState.target.val
    -   
    +
        # make sure that i < j
        if j < i then i :=: j
        if i < 0 then i := 0
    @@ -120,7 +120,7 @@ method printFrames(i, j)
              DState.Write("   (More stack frames follow...)")
           }
        else if i<=level then{
    -      DState.Write("") 
    +      DState.Write("")
           every f := i to level do
               printFrame(f)
            }
    @@ -128,7 +128,7 @@ method printFrames(i, j)
           DState.State := ERROR
           Message := "\n   No more frames, end of stack"
           DState.Write(Message)
    -      } 
    +      }
     end
     
     #
    @@ -137,18 +137,18 @@ end
     method cmdUp(cmd)
        local level, CMonitored := DState.coState.target.val
     
    -   level := keyword("level", CMonitored) - 1 
    +   level := keyword("level", CMonitored) - 1
        if DState.State = PAUSE then {
           if DState.coState.target.curr_frame = level then
              DState.Write("\n   No more Frames up !!!")
           # move up one frame, need to update curr symbol table
           else {
    -         DState.coState.target.curr_frame +:= 1 
    +         DState.coState.target.curr_frame +:= 1
              if not printFrame(DState.coState.target.curr_frame) then {
                 DState.Write("\n   No more Frames up !!!")
    -            DState.coState.target.curr_frame -:= 1 
    +            DState.coState.target.curr_frame -:= 1
                 }
    -	 }
    +         }
           }
        else {
           DState.State := ERROR
    @@ -170,7 +170,7 @@ method cmdDown(cmd)
           else {
              DState.coState.target.curr_frame -:= 1
              printFrame(DState.coState.target.curr_frame)
    -	 }
    +         }
           }
        else {
           DState.State := ERROR
    @@ -191,7 +191,7 @@ method cmdFrame(cmd)
           CMonitored := DState.coState.target.val
           if *cmd = 1 then {
              printFrame(DState.coState.target.curr_frame)
    -	 }
    +         }
           else {
              if frame := integer(cmd[2]) then {
                 level := keyword("level", CMonitored) - 1
    @@ -239,9 +239,9 @@ method cmdBacktrace(cmd)
                 if BaseFrame < level then {
                    Message:= "---Type  to continue, or q  to quit---"
                    DState.Writes(Message)
    -               if *(ans:=DState.stateRead())~=0 & ans[1]==("q"|"Q") then break 
    +               if *(ans:=DState.stateRead())~=0 & ans[1]==("q"|"Q") then break
                    }
    -            } 
    +            }
              }
           else if *cmd = 2 & integer(cmd[2]) then{
              frames := integer(cmd[2])
    @@ -250,7 +250,7 @@ method cmdBacktrace(cmd)
              else if frames < 0 then{
                 BaseFrame := level + frames
                 frames := level
    -            } 
    +            }
              if frames < MaxFrame then
                 printFrames(BaseFrame, BaseFrame + frames)
              else{
    @@ -268,7 +268,7 @@ method cmdBacktrace(cmd)
                       Message  := "---Type  to continue, _
                                   or q  to quit---"
                       DState.Writes(Message)
    -                  if *(ans:=DState.stateRead())~=0 & ans[1]==("q"|"Q") then break 
    +                  if *(ans:=DState.stateRead())~=0 & ans[1]==("q"|"Q") then break
                       }
                    }
                 }
    @@ -288,7 +288,7 @@ end
     initially()
     
        MaxFrame  := 9
    -   BaseFrame := 0 
    +   BaseFrame := 0
     
        Message := ""
     end
    diff --git a/uni/udb/state.icn b/uni/udb/state.icn
    index 13786b4bc..c6e956a61 100644
    --- a/uni/udb/state.icn
    +++ b/uni/udb/state.icn
    @@ -11,7 +11,7 @@ import json
     link ximage
     
     #
    -# This class is used to handle the current debugging state of UDB 
    +# This class is used to handle the current debugging state of UDB
     #
     class State(
        TP,              # TargetProgram and its arguments
    @@ -21,13 +21,13 @@ class State(
        RunCount,        # integer counts number of runs a program has in a session
     
        MaskTable,       # a table that maps eventcodes into their value masks
    -   eventMask,       # the cset of the main evaluator set of event codes 
    +   eventMask,       # the cset of the main evaluator set of event codes
        valueMask,       # table used for breakpoints and watchpoints set of masks
        breakMask,       # a set of the E_Line values that we like to break on
        watchChangeMask, # a set of the E_Assign values that we like to watch
        watchReadMask,   # a set of the E_Deref values that we like to watch
        internalMask,    # The cset of the active internals event mask
    -   externalMask,    # The cset of the active externals event mask   
    +   externalMask,    # The cset of the active externals event mask
        traceMask,       # a cset of &eventcode(s) of wanted traced fetures
     
        assertEventMask, # a cset of the active temporal assertions event masks
    @@ -53,7 +53,7 @@ class State(
     method Write(Msg)
        if /Msg then
           Msg := Message
    -   
    +
        if \mode == "-adapter" then {
           if type(Msg) == "table" then {
              if member(Msg, "code") then
    @@ -95,7 +95,7 @@ end
     method Writes(Msg)
        if /Msg then
           Msg := Message
    -   
    +
        if \mode == "-adapter" then {
           if type(Msg) == "table" then {
              if member(Msg, "code") then
    @@ -144,18 +144,18 @@ method constructEventMask()
        local x
     
        ## write("----> state.icn: re-constructing all of event mask and value mask")
    -   if *internalMask >0 | *externalMask >0    | 
    +   if *internalMask >0 | *externalMask >0    |
           *traceMask >0    | *assertEventMask >0 then{
           eventMask := cset(E_CoCreate || E_Coact || E_Cofail || E_Coret ||
    -			E_Error || E_Exit || E_Signal || E_MXevent ||
    -			E_Collect || E_EndCollect) ++
    +                        E_Error || E_Exit || E_Signal || E_MXevent ||
    +                        E_Collect || E_EndCollect) ++
                        internalMask ++ externalMask ++ traceMask ++ assertEventMask
           if *breakMask > 0 | *assertEventMask > 0 then{
              if member(traceMask,E_Line)    |
                 member(internalMask,E_Line) | member(externalMask,E_Line) then
                 delete(valueMask,E_Line)
              else{
    -            eventMask ++:= cset(E_Line) 
    +            eventMask ++:= cset(E_Line)
                 valueMask[E_Line] := breakMask ++ assertLoc
                 }
              }
    @@ -193,8 +193,8 @@ method constructEventMask()
           }
        else{ # *internalMask = 0 & *externalMask = 0 & *traceMask = 0
           eventMask := cset(E_Error || E_Exit || E_Signal ||
    -			E_CoCreate || E_Coact || E_Cofail || E_Coret ||
    -			E_Collect || E_EndCollect)
    +                        E_CoCreate || E_Coact || E_Cofail || E_Coret ||
    +                        E_Collect || E_EndCollect)
           if *breakMask > 0 then {
              eventMask ++:= cset(E_Line)
              valueMask[E_Line] := breakMask
    @@ -221,24 +221,24 @@ method constructEventMask()
     end
     
     #
    -# Update the debug state 
    +# Update the debug state
     # cmd =("run" | "rerun" | "continue" | "step" | "next"| "fresh" | "break")
     # enable/disable -internal/external,
    -#  
    +#
     method Update(state)
     
        if /state then state := State else  State := state
        case state of {
          LOAD :{
    -          #write("\n   --- a program just loaded ---") 
    +          #write("\n   --- a program just loaded ---")
               }
          RUN  |
          RERUN:{
             RunCount +:= 1
    -	# maybe should unconditionally set RunCode := RUN here
    -	if RunCode === SIGNAL then RunCode := RUN
    +        # maybe should unconditionally set RunCode := RUN here
    +        if RunCode === SIGNAL then RunCode := RUN
             constructEventMask()
    -        } 
    +        }
          PAUSE   |
          CONTINUE:{
             constructEventMask()
    @@ -256,19 +256,19 @@ method Update(state)
             if not member(eventMask, E_PatAttempt) then eventMask ++:=
                                                    cset(E_PatAttempt)
             if \valueMask[E_PatAttempt] then       delete(valueMask, E_PatAttempt)
    -	if not member(eventMask, E_PelemAttempt) then eventMask ++:=
    +        if not member(eventMask, E_PelemAttempt) then eventMask ++:=
                                                    cset(E_PelemAttempt)
             if \valueMask[E_PelemAttempt] then     delete(valueMask, E_PelemAttempt)
    -	if not member(eventMask, E_PatMatch) then eventMask ++:=
    -					       cset(E_PatMatch)
    -	if \valueMask[E_PatMatch] then         delete(valueMask, E_PatMatch)
    +        if not member(eventMask, E_PatMatch) then eventMask ++:=
    +                                               cset(E_PatMatch)
    +        if \valueMask[E_PatMatch] then         delete(valueMask, E_PatMatch)
             if not member(eventMask, E_PatFail)  then eventMask ++:= cset(E_PatFail)
             if \valueMask[E_PatFail] then             delete(valueMask, E_PatFail)
             if not member(eventMask, E_PelemMatch) then eventMask ++:=
    -	                                       cset(E_PelemMatch)
    -	if \valueMask[E_PelemMatch] then       delete(valueMask, E_PelemMatch)
    +                                               cset(E_PelemMatch)
    +        if \valueMask[E_PelemMatch] then       delete(valueMask, E_PelemMatch)
             if not member(eventMask, E_PelemFail) then eventMask ++:=
    -	                                       cset(E_PelemFail)
    +                                               cset(E_PelemFail)
             if \valueMask[E_PelemFail] then        delete(valueMask, E_PelemFail)
             if not member(eventMask, E_PatVal) then eventMask ++:= cset(E_PatVal)
             if \valueMask[E_PatValue] then        delete(valueMask, E_PatVal)
    @@ -305,7 +305,7 @@ method initializeState(tp)
           RunCode := NONE
           Write(Message)
           }
    -   # load | load args | udb | udb args 
    +   # load | load args | udb | udb args
        # reload current program or load new program
        else if *(\tp) > 0 | *TP > 0 then {
           # if a program is running, check for user input
    @@ -323,7 +323,7 @@ method initializeState(tp)
                 Writes(resultTable)
              }
     
    -         # no, don't load 
    +         # no, don't load
              if isNo(ans) then {
                 State := SKIP
                 fail
    @@ -331,7 +331,7 @@ method initializeState(tp)
              # yes, restart session then reinitialize
              else {
                 # Exit out of this run of startSession()
    -            State := RELOAD 
    +            State := RELOAD
     
                 # renew TP if loading new program
                 if *tp > 0 & *TP > 0 then {
    @@ -349,7 +349,7 @@ method initializeState(tp)
                 reinitState()
                 }
              # load new program, reset TP
    -         if *(\tp) > 0 then 
    +         if *(\tp) > 0 then
                 TP := tp
     
              # check if the TP is loadable and accessable.
    @@ -370,7 +370,7 @@ $ifdef TEST
                    State := RUN ###### TEST : For the sake of getting the Time right
     $endif
                    Message ||:= "\n   "|| srcFile.exeName ||" : loaded "||
    -                            srcFile.exeSize||" of "||icode.icodeVersion 
    +                            srcFile.exeSize||" of "||icode.icodeVersion
                    found := *srcFile.foundFiles
                    if found > 0 then {
                       if found > 1 then plural := "s are " else plural := " is "
    @@ -426,7 +426,7 @@ method update_cmdHistory(line)
        # cmdHistory[1]=""
        every i:=2 to *cmdHistory do
           if line == cmdHistory[i] then{
    -         delete(cmdHistory,i)    
    +         delete(cmdHistory,i)
              break
              }
        push(cmdHistory,line)
    @@ -435,23 +435,23 @@ end
     #
     # refresh the debugging state to the default settings
     #
    -method Fresh() 
    +method Fresh()
     
        # Initially, eventMask does not contain the E_Line & E_Assign events
        # If there is a breakpoint, E_Line will be added to the eventMask,
        # and the breakpoint linenum will be inserted in valueMask[E_Line] set
        # Also, initially the eventMask will not contain the E_Assign event
    -   # If there is a watchpoint then the E_Assign will be added and the 
    +   # If there is a watchpoint then the E_Assign will be added and the
        # variable will be added to the watchMask set.
    - 
    +
        eventMask       := cset(E_Error || E_Exit || E_Signal ||
    -			   E_CoCreate || E_Coact || E_Cofail || E_Coret) 
    +                           E_CoCreate || E_Coact || E_Cofail || E_Coret)
        internalMask    :=
        externalMask    :=
        traceMask       :=
        assertEventMask := ''
     
    -   valueMask       := table() 
    +   valueMask       := table()
        assertVars      := set()
        breakMask       := set()
        watchChangeMask := set()
    @@ -529,7 +529,7 @@ initially()
        coState   := CoexpState()
     
        eventMask       := cset(E_Error || E_Exit || E_Signal ||
    -			   E_CoCreate || E_Coact || E_Cofail || E_Coret)
    +                           E_CoCreate || E_Coact || E_Cofail || E_Coret)
        Fresh()
     end
     
    @@ -546,4 +546,4 @@ end
     procedure isYesNo(val)
        if match(map(val), ""|"yes"|"no") then return
        else fail
    -end
    \ No newline at end of file
    +end
    diff --git a/uni/udb/stepping.icn b/uni/udb/stepping.icn
    index 91744b84b..c9145cadf 100644
    --- a/uni/udb/stepping.icn
    +++ b/uni/udb/stepping.icn
    @@ -13,9 +13,9 @@ $include "patdefs.icn"
     record patLevel(
        pat,         #pattern at nested level
        pcode,       #the pcode at the ocurrence of the push
    -   index, 	#index at which the parent this element recursed.
    -   parent_off   #parent offset from end node (this may be the same for different nodes) 
    -   )		
    +   index,       #index at which the parent this element recursed.
    +   parent_off   #parent offset from end node (this may be the same for different nodes)
    +   )
     
     class Stepping(
        DState,      # (Alias) object of type State class
    @@ -24,14 +24,14 @@ class Stepping(
        nex_level,   # used with the next command to skip over a call
        msg,         # a string with latest message from this class
        pat,         # store the current pstep pattern
    -   plevel,      # a list that stores the different nested levels of a pmatch   
    +   plevel,      # a list that stores the different nested levels of a pmatch
        curPelem,    # the current pelem we are on
    -   pPos,        # stores the previous position of the current total match       
    +   pPos,        # stores the previous position of the current total match
        evalVal,     # stores the value of an unevaluated resolved expression
        curPlevel,   # the current level of nested pattern (associated with numNodes)
    -   numNodes     # stores the current number of nodes	       
    -   )	
    -	       
    +   numNodes     # stores the current number of nodes
    +   )
    +
     #
     # while next_count > 0, keep next until it is 0,
     # then stop there and change the state to step
    @@ -45,7 +45,7 @@ method checkNext()
        if level > nex_level & once = 0 then{
           next_count +:=1
           once := 1
    -      } 
    +      }
     
        if level = nex_level then{
           if next_count > 1 then{
    @@ -64,16 +64,16 @@ end
     
     #
     # Steps only one line of execution, treats procedure call as one operation
    -# [next], [next n]; n's default value is one  
    +# [next], [next n]; n's default value is one
     #
     method cmdNext(cmd)
        local count
     
        if DState.State = PAUSE & DState.RunCode ~= ERROR then {
           if count := integer(cmd[2]) then
    -	 next_count := count
    +         next_count := count
           else
    -	 next_count := 1
    +         next_count := 1
     
           nex_level := keyword("level", MONITORED)
           DState.Update(NEXT)
    @@ -81,7 +81,7 @@ method cmdNext(cmd)
           }
        else {
           DState.State := ERROR
    -      DState.runtimeErrorMsg()      
    +      DState.runtimeErrorMsg()
     #      msg   := "\n   The program is not being run._
     #                \n   Try \"run\", or Type \"help\" for assistance"
     #      DState.Write(msg)
    @@ -91,7 +91,7 @@ end
     #
     # helps return from the current procedure level to the previous level
     #
    -method cmdReturn(cmd) 
    +method cmdReturn(cmd)
     
        if DState.State = PAUSE then {
           if DState.RunCode ~= ERROR then {
    @@ -106,7 +106,7 @@ method cmdReturn(cmd)
              }
           else {
              DState.State := ERROR
    -         DState.runtimeErrorMsg()      
    +         DState.runtimeErrorMsg()
              }
           }
        else {
    @@ -137,7 +137,7 @@ method checkStep()
           step_count -:= 1
           DState.State := RUN
           DState.RunCode := PSTEP
    -      return 
    +      return
           }
     
        if step_count > 1 then {
    @@ -198,7 +198,7 @@ method cmdStep(cmd)
              }
           else {
              DState.State := ERROR
    -         DState.runtimeErrorMsg()      
    +         DState.runtimeErrorMsg()
              }
           }
        else {
    @@ -218,7 +218,7 @@ method checkPStep()
     
        cur_file := keyword("file", MONITORED)
        cur_line := keyword("line", MONITORED)
    - 
    +
        if step_count > 1 then {
           silentStep()
           DState.State := RUN
    @@ -226,10 +226,10 @@ method checkPStep()
           }
        else if step_count = 1 then {
           if cur_file == "__faux.icn" then {
    -	 DState.State := RUN
    -	 DState.RunCode := PSTEP
    -	 return
    -         }  
    +         DState.State := RUN
    +         DState.RunCode := PSTEP
    +         return
    +         }
     
           step_count -:= 1
     
    @@ -243,7 +243,7 @@ method checkPStep()
              evalVal    := &null
              pat := &eventvalue
              push(plevel, patLevel(&eventvalue, PC_Unanchored, -1, 1))
    -         pPos := keyword("pos", MONITORED) 
    +         pPos := keyword("pos", MONITORED)
              msg := "\n   Pattern match started"
              msg||:="\n   file "||cur_file||", line "||cur_line||"."
              msg||:="\n   "||cur_line-1||":"||
    @@ -283,14 +283,14 @@ method handle_pstep_fail()
     
              msg ||:= "\n   Pat: "||patElem[1]
              msg ||:= "\n" || patElem[2]
    -   
    -         step_count := 1 
    +
    +         step_count := 1
              DState.Write(msg)
              DState.State := RUN
              DState.RunCode := PSTEP
    -         return 
    -         } 
    -      PC_Assign | PC_R_Remove | PC_R_Restore | PC_Arbno_Y :{        
    +         return
    +         }
    +      PC_Assign | PC_R_Remove | PC_R_Restore | PC_Arbno_Y :{
              step_count := 1     ##Restore Stepping, not really a "step"
              DState.State := RUN
              DState.RunCode := PSTEP
    @@ -307,7 +307,7 @@ method handle_pstep_fail()
              patElem := getPatElem(pat, cur_index)
              if pat ~=== plevel[*plevel].pat then{
                 upElem := getPatElem(plevel[*plevel - (plevel[1].parent_off - 1)].pat,
    -				 plevel[1].index)
    +                                 plevel[1].index)
                 if DState.State = ERROR then {
                    DState.Write("\n   Error in pattern element imaging - UDB")
                    return
    @@ -331,7 +331,7 @@ end
     
     ## several pcodes related to pushing and popping
     ## require special handling before they hit
    -## node_fail. This is where they are handled. 
    +## node_fail. This is where they are handled.
     
     method handle_pstep_attempt()
        local cur_line, cur_file
    @@ -344,9 +344,9 @@ method handle_pstep_attempt()
        if curPelem = PC_R_Restore | curPelem = PC_R_Remove then {
           if curPelem = PC_R_Restore then
              msg := "\n   Pattern Element Failed, Entering Nested Layer... "
    -      else 
    +      else
              msg := "\n   Nested Elements Failed , Exiting Nested Layer... "
    -  
    +
           pop(plevel)
           pat := plevel[1].pat
           numNodes -:= 1
    @@ -354,7 +354,7 @@ method handle_pstep_attempt()
           DState.Write(msg)
           DState.State := RUN
           DState.RunCode := PSTEP
    -      return 
    +      return
           }
        else if curPelem = PC_Arbno_X | curPelem = PC_Arbno_S | curPelem = PC_Arb_X then {
           cur_index := keyword("patindex", MONITORED)
    @@ -398,7 +398,7 @@ method handle_pstep_match()
           PC_Assign_Imm | PC_Assign_OnM | PC_Setcur: {
              if curPelem = PC_Assign_Imm then
                 msg := "\n   Value assigned "
    -         else if curPelem = PC_Assign_OnM then 
    +         else if curPelem = PC_Assign_OnM then
                 msg := "\n   Value assigned on match "
              else if curPelem = PC_Setcur then {
                 msg := "\n   "||"pos:"||keyword("pos", MONITORED)||" assigned"
    @@ -418,7 +418,7 @@ method handle_pstep_match()
              DState.Write(msg)
              DState.State := RUN
              DState.RunCode := PSTEP
    -         return 
    +         return
              }
           PC_Fence_X | PC_R_Enter | PC_Arbno_Y | PC_Unanchored: {
              if curPelem = PC_Unanchored then { ## Match is retrying. Reset State
    @@ -435,7 +435,7 @@ method handle_pstep_match()
              step_count := 1
              DState.State := RUN
              DState.RunCode := PSTEP
    -         return 
    +         return
              }
           default : {
              processed := getSub()
    @@ -448,7 +448,7 @@ method handle_pstep_match()
           patElem := getPatElem(pat, cur_index)
           if pat ~=== plevel[*plevel].pat then{
              upElem := getPatElem(plevel[*plevel - (plevel[1].parent_off - 1)].pat,
    -   			      plevel[1].index)
    +                              plevel[1].index)
              if DState.State = ERROR then {
                 DState.Write("\n   Error in pattern element imaging - UDB")
                 return
    @@ -458,7 +458,7 @@ method handle_pstep_match()
              }
     
           msg ||:= "\n   Pat: "||patElem[1]
    -      msg ||:= "\n"||patElem[2] 
    +      msg ||:= "\n"||patElem[2]
           if curPelem = PC_Rpat | curPelem = PC_Pred_Func | curPelem = PC_Pred_MF                        | curPelem = PC_String_VF | curPelem = PC_String_MF then
           msg ||:= "\n   Val: " || image(evalVal)
     
    @@ -478,7 +478,7 @@ method handle_PatStack()
        if &eventcode == E_PatPush then {
           if curPelem ~= PC_Rpat & curPelem ~= PC_Pred_Func & curPelem ~= PC_Pred_MF then {
              if &eventvalue ~= 0 then {  ## 0 indicates single node push. Dont care
    -            cur_index := plevel[1].index 
    +            cur_index := plevel[1].index
                 push(plevel, patLevel(pat, PC_R_Enter, cur_index, curPlevel))
                 numNodes +:= 1
                 }
    @@ -490,10 +490,10 @@ method handle_PatStack()
        ## (once for EOP and once for Assign_?? so they exist twice on the stack
     
        else if &eventcode == E_PatPop then {
    -      if curPelem = PC_EOP then {  
    +      if curPelem = PC_EOP then {
              pat := plevel[*plevel - (plevel[1].parent_off - 1)].pat
              push(plevel, plevel[*plevel - (plevel[1].parent_off - 1)])
    -         numNodes +:= 1 
    +         numNodes +:= 1
              curPlevel := numNodes
              }
           if curPelem = PC_Assign_Imm | curPelem = PC_Assign_OnM then {
    @@ -504,11 +504,11 @@ method handle_PatStack()
        else{
           if type(&eventvalue) ~== "pattern" then evalVal := &eventvalue
           else {
    -         pat := &eventvalue  ## push a recursive pattern on the stack 
    +         pat := &eventvalue  ## push a recursive pattern on the stack
              numNodes +:= 1
              curPlevel := numNodes
              push(plevel, patLevel(pat, curPelem, cur_index, curPlevel - 1))
    -         } 
    +         }
           }
     end
     
    @@ -530,10 +530,10 @@ method getSub()
                    every &pos to cur_pos - 1 do images[2] ||:= "."
                    images[2] ||:= "^"
                    }
    -            else images[2] ||:= "   " 
    +            else images[2] ||:= "   "
                 }
     
    -         if pPos = cur_pos then {  ## pPos is the current (no dots) 
    +         if pPos = cur_pos then {  ## pPos is the current (no dots)
                 every &pos to cur_pos - 1 do images[2] ||:= " "
                 images[2] ||:= "^"
                 }
    @@ -587,7 +587,7 @@ method getPatElem(p, index)
                  DState.State := ERROR
                  msg := "\n   Error: No Bracketed Image found before EOP"
                  DState.Write(msg)
    -             return 
    +             return
                  }
              move(1)
              }
    @@ -612,7 +612,7 @@ method getPatElem(p, index)
                 under_image ||:= " "
                 }
              }
    -      else {                              ##else tab to the element and then   
    +      else {                              ##else tab to the element and then
              add_image := tab(elemStart)      ##allocate white space underneath line
              every 1 to *add_image do under_image ||:= " "
              final_image ||:= add_image
    @@ -671,7 +671,7 @@ method silentStep()
               pat := plevel[*plevel].pat
               pPos := keyword("pos", MONITORED)
               push(plevel, patLevel(pat, PC_Unanchored, -1, 1))
    -          return 
    +          return
               }
            default: {
               step_count -:= 1
    @@ -771,7 +771,7 @@ method cmdPrintStack()
     
        ##Print the first child. Layer 0
     
    -   if curPelem == PC_Arb_X then 
    +   if curPelem == PC_Arb_X then
           patElem := getPatElem(cur_pat.pat, keyword("patindex", MONITORED) - 1)
        else
           patElem := getPatElem(cur_pat.pat, keyword("patindex", MONITORED))
    @@ -780,30 +780,30 @@ method cmdPrintStack()
           return
           }
        msg ||:= "\n"||space||"#"||count||": "||patElem[1]
    -   msg ||:= "\n"||patElem[2] 
    +   msg ||:= "\n"||patElem[2]
        count +:= 1
     
        ##Print the parents using the children (as the children have the parent's
        ##recursive index )
     
        while cur_pat.pat ~=== plevel[*plevel].pat do {
    -      if curPelem == PC_Arb_X then 
    +      if curPelem == PC_Arb_X then
              patElem := getPatElem(plevel[*plevel - (plevel[level].parent_off - 1)].pat,
    -	                	 plevel[level].index - 1)
    -      else 
    +                                 plevel[level].index - 1)
    +      else
              patElem := getPatElem(plevel[*plevel - (plevel[level].parent_off - 1)].pat,
    -				 plevel[level].index)
    +                                 plevel[level].index)
           if DState.State = ERROR then {
              DState.Write("\n   Error in pattern element imaging - UDB")
              return
              }
    -   
    +
           ##if the number grows beyond 100 this will look off but won't fail
     
           if level > 9 then space := "   "
           else if level > 99 then space := "  "
           msg ||:= "\n"||space|| "#"||count||": "||patElem[1]
    -      msg ||:= "\n"||patElem[2] 
    +      msg ||:= "\n"||patElem[2]
           count +:= 1
           cur_pat := plevel[*plevel - (plevel[level].parent_off - 1)]
           level := *plevel - (plevel[level].parent_off - 1)
    @@ -815,7 +815,7 @@ end
     
     #
     # Steps during pattern execution or on line if a
    -# E_Line event has been triggered. 
    +# E_Line event has been triggered.
     # [pstep], [pstep n]; n's default value is one
     #
     
    @@ -832,7 +832,7 @@ method cmdPStep(cmd)
              }
           else {
              DState.State := ERROR
    -         DState.runtimeErrorMsg()      
    +         DState.runtimeErrorMsg()
              }
           }
        else {
    @@ -862,10 +862,10 @@ method pEnd()
              }
           DState.Write(msg)
           DState.State := PAUSE
    -      } 
    +      }
     
        DState.RunCode := STEP
    -   
    +
        pPos       := 1
        realIndex  := -1
        curPlevel  := 1
    @@ -887,10 +887,10 @@ method cmdContinue()
           if DState.RunCode ~= ERROR then {
              DState.Update(CONTINUE)
              DState.Write("   Continuing.")
    -	 }
    +         }
           else {
              DState.State := ERROR
    -         DState.runtimeErrorMsg()      
    +         DState.runtimeErrorMsg()
              }
           }
        else {
    @@ -905,10 +905,10 @@ end
     # Initialization
     #
     initially()
    -   
    -   step_count := 0 
    +
    +   step_count := 0
        next_count := 0
    -   pPos       := 1 
    +   pPos       := 1
        curPlevel  := 1
        numNodes   := 1
        nex_level  := &null
    diff --git a/uni/udb/symtab.icn b/uni/udb/symtab.icn
    index 89ed93eed..e384dd0aa 100644
    --- a/uni/udb/symtab.icn
    +++ b/uni/udb/symtab.icn
    @@ -1,30 +1,30 @@
     #
    -# symtab.icn - creates a symbol table with filename and line number information 
    +# symtab.icn - creates a symbol table with filename and line number information
     # Author - Gigi Young
     #
     
     class Symtab(
    -   parent,	# reference to parent symtab, if any
    -   tag,		# instance type (global, proc, record, class, method, package)
    -   label,	# identifier
    -   filename,	# filename that symbol is contained in
    +   parent,      # reference to parent symtab, if any
    +   tag,         # instance type (global, proc, record, class, method, package)
    +   label,       # identifier
    +   filename,    # filename that symbol is contained in
        abs_filename,# absolute filename that symbol is contained in
    -   start_line,	# starting line number of symbol
    -   end_line,	# endinf line number of symbol
    +   start_line,  # starting line number of symbol
    +   end_line,    # endinf line number of symbol
     
    -   filetab,	# two-layered table that gives a symbol table for a 
    -		# proc, class, or pkg with a filename and line number
    -		#
    -		# filetab[filename] => table of symtabs associated with 
    -		#        [filename] with lineno as keys (lineno_tab)
    -		# lineno_tab[line] => symtab of [filename:lineno]
    -		#
    +   filetab,     # two-layered table that gives a symbol table for a
    +                # proc, class, or pkg with a filename and line number
    +                #
    +                # filetab[filename] => table of symtabs associated with
    +                #        [filename] with lineno as keys (lineno_tab)
    +                # lineno_tab[line] => symtab of [filename:lineno]
    +                #
     
    -   nametab,	# table that gives the symbol table for a proc, class
    -		# or package with a name
    +   nametab,     # table that gives the symbol table for a proc, class
    +                # or package with a name
     
    -   pkgtab, 	# procedures and globals may share names with a package. 
    -		# separate table for packages (key: pkg name, value: pkg symtab
    +   pkgtab,      # procedures and globals may share names with a package.
    +                # separate table for packages (key: pkg name, value: pkg symtab
     
     # space vs efficiency - Each time a lookup is called, requires sifting through
     #                       tables to find correct name type, efficiency O(n) where
    @@ -37,7 +37,7 @@ class Symtab(
                     # "global", "package" - global variable
                     # "proc", "method" - local variable
                     # "class", "record - member variable
    -   statics,     # static variables, only for "proc", "method"   
    +   statics,     # static variables, only for "proc", "method"
        params,      # parameters, only for "proc", "method"
     
        procs,
    @@ -67,12 +67,12 @@ method initialize(fileText)
           # globalnames() keeps a reference for strings in the icode
           # This is very bad for multiple loaded programs
           # So, this image() thing takes care of the problem by
    -      # allocating a new string in the string region. 
    +      # allocating a new string in the string region.
           x := image(x)[2:-1]
     
           if find("__oprec",x) then next # skip oprecs
     
    -      # get TP's variable reference 
    +      # get TP's variable reference
           var_ref := variable(x, Monitored) # &null for global vars for some reason
           var_type := type(var_ref)
           var_img := image(var_ref)
    @@ -87,7 +87,7 @@ method initialize(fileText)
           #debug("var_type: '",var_type,"'   var_img: '",var_img,"'")
           #debug("var_tag: '",var_tag,"'   var_name: '", var_name,"'")
     
    -      # unmangle name - 
    +      # unmangle name -
           # class order - class constructor, record constructor, [methods], oprec,
           #               constructor, initialize
           pkg := cls := unmangled_name := &null
    @@ -96,11 +96,11 @@ method initialize(fileText)
              if temp := tab(find("__")) & move(2) then {
                 # class constructor/methods vector
                 if match("state"|"methods"|"oprec") then {
    -               cls := temp 
    +               cls := temp
                    }
                 # package
                 else {
    -               pkg := temp 
    +               pkg := temp
                    # package class constructor
                    if temp := tab(find("__")) & move(2) then {
                       if match ("state"|"methods"|"oprec") then {
    @@ -116,7 +116,7 @@ method initialize(fileText)
                          }
     
                       # check if class method
    -                  if temp := tab(find("_")) &  
    +                  if temp := tab(find("_")) &
                          member(classes, pkg||"__"||temp) & move(1) then {
                          cls := temp
                          }
    @@ -131,7 +131,7 @@ method initialize(fileText)
                    next
                    }
                 # check if class method
    -            if temp := tab(find("_")) &  
    +            if temp := tab(find("_")) &
                    member(classes, temp) & move(1) then {
                    cls := temp
                    }
    @@ -139,19 +139,19 @@ method initialize(fileText)
                 }
              }  # end unmangling
     
    -      #debug("package: '",pkg,"' | class: '", cls,"' | unmangled_name: '", unmangled_name,"'") 
    +      #debug("package: '",pkg,"' | class: '", cls,"' | unmangled_name: '", unmangled_name,"'")
     
           #
    -      # add to packages, classes, and packaged classes to sets 
    +      # add to packages, classes, and packaged classes to sets
           #
           if \pkg then {
              if not member(packages, pkg) then {
    -            insert(packages, pkg) 
    +            insert(packages, pkg)
                 new_symt := Symtab(self,"package",pkg)
    -            add_symtab(new_symt,var_ref) 
    +            add_symtab(new_symt,var_ref)
                 }
              if \cls then {
    -            if not member(classes, pkg||"__"||cls) then 
    +            if not member(classes, pkg||"__"||cls) then
                    insert(classes, pkg||"__"||cls)
                 }
              }
    @@ -188,7 +188,7 @@ method initialize(fileText)
                 }
              # add method
              else if cls_symt := symt.lookup_class(cls) then {
    -            new_symt := Symtab(cls_symt,"method",unmangled_name) 
    +            new_symt := Symtab(cls_symt,"method",unmangled_name)
                 cls_symt.add_symtab(new_symt,var_ref)
                 }
              }
    @@ -262,7 +262,7 @@ end
     
     #
     # A simplistic method for find the 'end' reserved word for methods and
    -# procedures. This method searches one line of text at a time. Success 
    +# procedures. This method searches one line of text at a time. Success
     # indicates that 'end' was found, and failure if not.
     #
     # May need additions/modifications in the future.
    @@ -273,8 +273,8 @@ method find_end_token(line)
     
        line ? {
           every i := find("end") do {
    -         # "end" is at start of line or preceeded by whitespace 
    -         if i = (1|many(ws)) & tab(i+3) then {  
    +         # "end" is at start of line or preceeded by whitespace
    +         if i = (1|many(ws)) & tab(i+3) then {
                 # "end" is at end of line
                 if tab(0) == "" then return
     
    @@ -288,12 +288,12 @@ method find_end_token(line)
     #               else if *tab(0) > 0 {
     #                  while any(ws,move(-1))
     #                  if c := move(-1) == "_" then fail
    -#                  } 
    +#                  }
                    }
                 }
              }
           }
    -   
    +
     end
     
     #
    @@ -303,44 +303,44 @@ method add_symtab(symt, var_ref)
        local filename, lineno
     
        #debug("adding to [",tag," ",label,"]")
    -   # check for redeclarations  
    +   # check for redeclarations
        if not add_symtab_name(symt, var_ref) then { fail }
    -   
    +
        # get filename/lineno info
        symt.filename := keyword("file",var_ref) | &null
        symt.start_line := keyword("line",var_ref) | &null
     
    -   # file/line info needed for method/proc lookups 
    -   if symt.tag == ("method"|"proc") then 
    +   # file/line info needed for method/proc lookups
    +   if symt.tag == ("method"|"proc") then
           add_to_filetab(symt)
     
        # add variables and scopes to bookkeeping fields
        case symt.tag of {
    -      "proc": { 
    +      "proc": {
              add_locals(symt,var_ref)
              add_statics(symt,var_ref)
              add_params(symt,var_ref)
    -         insert_sorted(procs, symt.label) 
    +         insert_sorted(procs, symt.label)
              }
    -      "method": { 
    +      "method": {
              add_locals(symt,var_ref)
              add_statics(symt,var_ref)
              add_params(symt,var_ref)
    -         insert_sorted(methods, symt.label) 
    +         insert_sorted(methods, symt.label)
              }
    -      "class": { 
    +      "class": {
              add_params(symt,var_ref)
    -         insert_sorted(classes, symt.label) 
    +         insert_sorted(classes, symt.label)
              }
    -      "record": { 
    +      "record": {
              add_params(symt,var_ref)
    -         insert_sorted(records, symt.label) 
    +         insert_sorted(records, symt.label)
              }
    -      "package": { 
    -         insert_sorted(packages, symt.label) 
    +      "package": {
    +         insert_sorted(packages, symt.label)
              }
    -      default: { 
    -         #debug("add_symtab(): unrecognized tag") 
    +      default: {
    +         #debug("add_symtab(): unrecognized tag")
              }
           }
        return
    @@ -352,21 +352,21 @@ end
     #
     method add_global(var_name)
        #debug("adding to [",tag," ",label,"]")
    -   if tag == ("global"|"package") & type(var_name) == "string" then { 
    +   if tag == ("global"|"package") & type(var_name) == "string" then {
           if /nametab[var_name] then {
              nametab[var_name] := "local"
    -         insert_sorted(locals, var_name) 
    -         print_add(var_name) 
    +         insert_sorted(locals, var_name)
    +         print_add(var_name)
              return
              }
           else {
              #debug("redeclaration of global ",var_name)
              }
    -      } 
    +      }
     end
     
     #
    -# Helper method that adds a symbol table entry to a symbol table. It fails if a 
    +# Helper method that adds a symbol table entry to a symbol table. It fails if a
     # redeclaration occurs. More specifically, it adds the name to the name table.
     #
     method add_symtab_name(symt,var_ref)
    @@ -390,21 +390,21 @@ method add_symtab_name(symt,var_ref)
              }
           #debug("redeclaration of ",symt.tag," ",s)
           #fail
    -      }      
    - 
    +      }
    +
        name_table[s] := symt
    -   print_add(symt) 
    +   print_add(symt)
     
        return
     end
     
     #
    -# Adds a symbol table scope entry to the file table. 
    +# Adds a symbol table scope entry to the file table.
     #
     method add_to_filetab(symt)
        local filename, i, Self := self
        filename := symt.filename
    -   i := symt.start_line 
    +   i := symt.start_line
     
        # go to the global symbol table
        while Self.tag ~== "global" do Self := Self.parent
    @@ -416,7 +416,7 @@ end
     
     
     #method add_to_procs(symt)
    -#   if not member(procs, symt.label) then 
    +#   if not member(procs, symt.label) then
     #     # insert_sorted(procs, symt.label)
     #      insert_sorted(procs, symt.label)
     #end
    @@ -469,7 +469,7 @@ end
     method print_symtab(tabs:"")
        if /udb_debug_flag then fail
     
    -   writes(tabs,tag, " ", label) 
    +   writes(tabs,tag, " ", label)
        if \filename then
           write(" found at ",filename,":",
                  start_line,":",end_line)
    @@ -495,7 +495,7 @@ method print_add(x)
           case type(x) of {
              "Symtab__state": {
                 write("added '",x.tag," ",x.label,"' to '",tag," ",
    -                  label,"'") 
    +                  label,"'")
                 }
              "string": {
                 write("added global ",x," to '",tag," ",label,"'")
    @@ -509,7 +509,7 @@ end
     ################################
     
     #
    -# Locates and returns the appropriate scope with a filename and line number. 
    +# Locates and returns the appropriate scope with a filename and line number.
     # This search is done via the global symbol table.
     #
     method lookup_fileline(filename, lineno)
    @@ -517,7 +517,7 @@ method lookup_fileline(filename, lineno)
     
        if \filename & \lineno then {
           if not member(filetab, filename) then fail
    -      
    +
           line := numeric(lineno)
     
           # check for packages, package is a single file
    @@ -530,12 +530,12 @@ method lookup_fileline(filename, lineno)
                 #debug(image(temp)," is not a symtab")
                 fail
                 }
    -           
    +
              symt := temp
     
    -         # class, search for methods 
    +         # class, search for methods
              if symt.tag == "class" then {
    -            if \(temp := symt.filetab[filename][line]) then 
    +            if \(temp := symt.filetab[filename][line]) then
                    symt := temp
                 }
              return symt
    @@ -546,11 +546,11 @@ method lookup_fileline(filename, lineno)
           }
     end
     
    -method lookup_name(name) 
    +method lookup_name(name)
        local x
        if \name then {
    -      if \(x := nametab[name]) then 
    -         return x 
    +      if \(x := nametab[name]) then
    +         return x
           }
     end
     
    @@ -605,7 +605,7 @@ method lookup_package(pkg)
     end
     
     #
    -# Used by class Data for printing source information. Looks for a class 
    +# Used by class Data for printing source information. Looks for a class
     # within the global symbol table, or within a package specified by (pkg),
     # if given.
     #
    @@ -635,7 +635,7 @@ end
     
     #
     # Gets the unmangled name for a variable, proc, or class in a package
    -# 
    +#
     #method get_unmangled_name(s)
     #   local unmangled_name := s
     #   s ? {
    @@ -650,7 +650,7 @@ end
     #
     #method get_filename(s)
     #   local filename
    -#     
    +#
     #   s ? {
     #      tab(0)
     #      while (c := move(-1)) ~== "/"
    @@ -663,7 +663,7 @@ end
     # init
     #
     initially
    -   start_line := 
    +   start_line :=
        end_line   := "??"
        filetab := table()
        nametab := table()
    diff --git a/uni/udb/trace.icn b/uni/udb/trace.icn
    index 05c45988e..a5000af0f 100644
    --- a/uni/udb/trace.icn
    +++ b/uni/udb/trace.icn
    @@ -14,7 +14,7 @@ link evnames
     #
     record LocationRec(
        fname, # is the source file name that has the current procedure
    -   line,  # is the line in the source file that starts on 
    +   line,  # is the line in the source file that starts on
        level, # is the level of the procedure in the execution stack
        ecode  # the current event code at that location
        )
    @@ -27,12 +27,12 @@ class TraceRec(
        id,         # integer identifies the tracepoint number
        hitMax,     # integer specifies the number of hits before notifying the user
        hitCount,   # integer counts the total number of Tracepoint hits
    -   missCount,  # integer counts the total number of Tracepoint misses 
    +   missCount,  # integer counts the total number of Tracepoint misses
        op,         # the operation used in the watch condition
        traceValue, # the value that user wants to catch (trace); value of interes
        traceList,  # a list of LocationRec record, used for tracing back
        eventMask,  # a cset of the traced events
    -   state,      # an integer code tells if the trace is enabled/disabled/deleted 
    +   state,      # an integer code tells if the trace is enabled/disabled/deleted
        silent,     # tells when the trace is silent, not null = silent is on
        traceType,  # a string holds the type of the tracing commaand
        cmd,        # a string with the used command
    @@ -42,7 +42,7 @@ class TraceRec(
     
        #
        # public method
    -   # returns the trace name based on the trace type 
    +   # returns the trace name based on the trace type
        #
        method getTraceName()
           return case traceType of {
    @@ -166,7 +166,7 @@ method checkTraceValue(name)
                 fail   }
              }
           traceBehavior[name].missCount +:= 1
    -      return   
    +      return
           }
        fail
     end
    @@ -199,19 +199,19 @@ method checkTraceBehavior()
              traceBehavior[name].coexp.id ~= DState.coState.curr.id then fail
     
           if \ (tbnam := traceBehavior[name]) & tbnam.state = ENABLED &
    -	  member(tbnam.eventMask, &eventcode) then {
    +          member(tbnam.eventMask, &eventcode) then {
              if /tbnam.hitMax | tbnam.hitCount < abs(tbnam.hitMax) then {
                 if member(ReturnCode, &eventcode) & \ (tbnam.traceValue) then
                    return checkTraceValue(name)
                 else
                    printInfo(name)
                    return
    -            } 
    +            }
              }
           else
              fail
           }
    -end 
    +end
     
     #
     # private method
    @@ -219,9 +219,9 @@ end
     #
     method printInfo(name)
        local tbn, R := LocationRec(keyword("file", MONITORED) | "?",
    -			  keyword("line", MONITORED) | "?",
    -			  keyword("level", MONITORED)| "?",
    -			  &eventcode)
    +                          keyword("line", MONITORED) | "?",
    +                          keyword("level", MONITORED)| "?",
    +                          &eventcode)
     
        tbn := traceBehavior[name]
        push(tbn.traceList, R)
    @@ -235,7 +235,7 @@ method printInfo(name)
              return
              }
           }
    -   
    +
        DState.State := PAUSE
        DState.RunCode := TRACE
     
    @@ -249,13 +249,13 @@ method printInfo(name)
               R.fname||":"||R.line||
               " coexp "||DState.coState.curr.id
        msg||:=".\n   "||R.line||":"||
    -	  DState.srcFile.getSrcLine(R.fname, R.line)
    +          DState.srcFile.getSrcLine(R.fname, R.line)
        DState.Write(msg)
     end
     
     #
     # private method
    -# triggered at the end of a count watch, 
    +# triggered at the end of a count watch,
     # it notfies the user that there is no more watching
     #
     method showEndTraceInfo(name)
    @@ -264,7 +264,7 @@ method showEndTraceInfo(name)
        DState.State := PAUSE
        DState.RunCode := WATCH
     
    -   if traceBehavior[name].hitMax > 0 then { 
    +   if traceBehavior[name].hitMax > 0 then {
           msg :="\n   Reaching the last of "||traceBehavior[name].hitCount||" hits"
           if \traceBehavior[name].silent then {
              msg ||:=" of:\n   Tracepoint(Silent) #"
    @@ -279,7 +279,7 @@ method showEndTraceInfo(name)
        resultTable["requireResponse"] := "__true__"
        DState.Writes(resultTable)
        if DState.stateRead() == (""|"y"|"Y"|"yes"|"YES") then {
    -      if traceBehavior[name].hitMax > 0 then { 
    +      if traceBehavior[name].hitMax > 0 then {
              msg :="\n   --------------------------------------------------"
              every i := 1 to *traceBehavior[name].traceList do {
                 r := traceBehavior[name].traceList[i]
    @@ -299,7 +299,7 @@ end
     #
     method printOldTraceInfo(name, max)
        local i, r
    -   
    +
        if \traceBehavior[name].traceList then {
           msg  :="\n   Command   : " ||traceBehavior[name].cmd
           msg||:="\n   hit  total: " ||traceBehavior[name].hitCount
    @@ -314,7 +314,7 @@ method printOldTraceInfo(name, max)
     
           if \traceBehavior[name].hitMax then
              max := abs(traceBehavior[name].hitMax)
    -     
    +
           every i := 1 to max do {
              r := traceBehavior[name].traceList[i]
              msg||:="\n   "||i||"# at "||r.fname||":"||r.line||
    @@ -323,7 +323,7 @@ method printOldTraceInfo(name, max)
           }
        else
           msg := "\n   "||name||": has no trace info yet!"
    -   DState.Write(msg)   
    +   DState.Write(msg)
     end
     
     method constructTraceMsg(trace)
    @@ -331,7 +331,7 @@ method constructTraceMsg(trace)
        msg :="\n   Tracepoint #" ||trace.id||" on: "||trace.getTraceName()||
              trace.name
     
    -   if \(trace.coexp) then 
    +   if \(trace.coexp) then
           msg ||:=" coexp "||trace.coexp.id
     
        msg ||:="; Traced Behaviors: "||getBehaviorNames(trace.eventMask)||
    @@ -514,17 +514,17 @@ method addTracepoint(name, cmd, coexp)
           old_id := traceBehavior[name].id
           delete(traceBehavior,name)
           }
    -    
    +
        if *cmd > 4 then {
           op := cmd[4]
           val := cmd[5]
           }
        #TraceRec(name, id, hitMax, hitCount, missCount
        #         op, traceValue, traceList, eventMask, cmd, coexp)
    -   traceBehavior[name] := 
    -      TraceRec(cmd[2], (\old_id|id), hits, 0, 0, op, val, [], ecodeSet, 
    +   traceBehavior[name] :=
    +      TraceRec(cmd[2], (\old_id|id), hits, 0, 0, op, val, [], ecodeSet,
                    ENABLED, silent, traceType, DState.cmdHistory[1], coexp)
    -   # re-construct the traceMask 
    +   # re-construct the traceMask
        UpdateMask()
     
        msg := "\n   Tracepoint #" ||id||" on: "||
    @@ -542,7 +542,7 @@ method addTracepoint(name, cmd, coexp)
     end
     
     #
    -# build Variable(s) and/or Behavior(s) tracer  
    +# build Variable(s) and/or Behavior(s) tracer
     #
     method cmdTrace(cmd)
        local name, coexp, resultTable := table()
    @@ -553,12 +553,12 @@ method cmdTrace(cmd)
              # check for [coexp N]
              if *cmd >= 4 & cmd[-2] == "coexp" then {
                 if /(coexp := DState.coState.get_coexp(cmd[-1])) then {
    -	          DState.State := ERROR
    +                  DState.State := ERROR
                       msg := "\n   "||cmd[-2]||" "||cmd[1]||" does not exist."||
    -      	           "\n   Use command \"coexp\" to view activated co-expressions."
    +                   "\n   Use command \"coexp\" to view activated co-expressions."
                       DState.Write(msg)
                       fail
    -               } 
    +               }
                    until pull(cmd) == "coexp"
                 }
     
    @@ -602,9 +602,9 @@ end
     #
     # resolve tracing info, used by new command
     # (udb) trace [-silent] [count] object [behavior [op value]]
    -# 
    +#
     method resolveTraceInfo(cmd)
    -   
    +
        initNewCmd()
        if cmd[2] == ("-s"|"-silent") then {
           silent := 1
    @@ -664,7 +664,7 @@ method cmdClear(cmd)
                  i +:= 1
                  }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All tracepoints are cleared; ("||i||" total)."
                 }
    @@ -682,7 +682,7 @@ method cmdClear(cmd)
                    }
                 }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All tracepoints of type \""||cmd[2]||
                      "\" are cleared; ("||i||" total)."
    @@ -699,7 +699,7 @@ method cmdClear(cmd)
              every name := key(traceBehavior) do {
                 if traceBehavior[name].id = id then {
                    delete(traceBehavior, name)
    -               # re-construct the traceMask 
    +               # re-construct the traceMask
                    UpdateMask()
                    msg:="\n   Tracepoint #"||id||" is cleared."
                    DState.Write(msg)
    @@ -717,7 +717,7 @@ method cmdClear(cmd)
                 if member(traceBehavior, name) then {
                    id := traceBehavior[name].id
                    delete(traceBehavior, name)
    -               # re-construct the traceMask 
    +               # re-construct the traceMask
                    UpdateMask()
                    msg:="\n   Tracepoint #"||id||" : "|| name ||" is cleared."
                    DState.Write(msg)
    @@ -749,7 +749,7 @@ method cmdDelete(cmd)
           if cmd[2] == ("trace" | "tracepoints") then {
              every (!traceBehavior).condAble(DELETED) do i +:= 1
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All tracepoints are deleted; ("||i||" total)."
                }
    @@ -768,7 +768,7 @@ method cmdDelete(cmd)
                    }
                 }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All tracepoints of type \""||cmd[2]||
                      "\" are deleted; ("||i||" total)."
    @@ -786,7 +786,7 @@ method cmdDelete(cmd)
              every tb := !traceBehavior do {
                 if tb.id = id then {
                    if tb.condAble(DELETED) then {
    -                  # re-construct the traceMask 
    +                  # re-construct the traceMask
                       UpdateMask()
                       msg:="\n   Tracepoint #"||id||" is deleted."
                       DState.Write(msg)
    @@ -800,7 +800,7 @@ method cmdDelete(cmd)
                       DState.Write(msg)
                       fail
                       }
    -               } 
    +               }
                 }
              msg := "\n   Tracepoint #"||id||" is not available."
              DState.Write(msg)
    @@ -814,7 +814,7 @@ method cmdDelete(cmd)
                 if member(traceBehavior, name) then {
                    id := traceBehavior[name].id
                    if traceBehavior[name].condAble(DELETED) then {
    -                  # re-construct the traceMask 
    +                  # re-construct the traceMask
                       UpdateMask()
                       msg:="\n   Tracepoint #"||id||" is deleted."
                       DState.Write(msg)
    @@ -854,13 +854,13 @@ method cmdEnable(cmd)
        if *cmd = 2 then {
           if cmd[2] == ("trace" | "tracepoints") then {
              every (!traceBehavior).condAble(ENABLED) do {
    -	    i +:= 1
    +            i +:= 1
                 }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All tracepoints are enabled; ("||i||" total)."
    -            } 
    +            }
              else
                 msg:="\n   No tracepoints are available to be enabled."
              DState.Write(msg)
    @@ -876,7 +876,7 @@ method cmdEnable(cmd)
                    }
                 }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All disabled tracepoints of type \""||cmd[2]||
                      "\" are enabled; ("||i||" total)."
    @@ -894,7 +894,7 @@ method cmdEnable(cmd)
              every name := key(traceBehavior) do {
                 if traceBehavior[name].id = id then {
                    if traceBehavior[name].condAble(ENABLED) then {
    -                  # re-construct the traceMask 
    +                  # re-construct the traceMask
                       UpdateMask()
                       msg:="\n   Tracepoint #"||id||" is enabled."
                       DState.Write(msg)
    @@ -923,7 +923,7 @@ method cmdEnable(cmd)
                 if member(traceBehavior, name) then {
                    id := traceBehavior[name].id
                    if traceBehavior[name].condAble(ENABLED) then {
    -                  # re-construct the traceMask 
    +                  # re-construct the traceMask
                       UpdateMask()
                       msg:="\n   Tracepoint #"||id||" is enabled."
                       DState.Write(msg)
    @@ -969,7 +969,7 @@ method cmdDisable(cmd)
                    }
                 }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All tracepoints are enabled; ("||i||" total)."
                 }
    @@ -988,7 +988,7 @@ method cmdDisable(cmd)
                    }
                 }
              if i > 0 then {
    -            # re-construct the traceMask 
    +            # re-construct the traceMask
                 UpdateMask()
                 msg:="\n   All enabled tracepoints of type \""||cmd[2]||
                      "\" are disabled; ("||i||" total)."
    @@ -1006,7 +1006,7 @@ method cmdDisable(cmd)
              every name := key(traceBehavior) do {
                 if traceBehavior[name].id = id then {
                    if traceBehavior[name].condAble(DISABLED) then {
    -                  # re-construct the traceMask 
    +                  # re-construct the traceMask
                       UpdateMask()
                       msg:="\n   Tracepoint #"||id||" is disabled."
                       DState.Write(msg)
    @@ -1035,7 +1035,7 @@ method cmdDisable(cmd)
                 if member(traceBehavior, name) then {
                    id := traceBehavior[name].id
                    if traceBehavior[name].condAble(DISABLED) then {
    -                  # re-construct the traceMask 
    +                  # re-construct the traceMask
                       UpdateMask()
                       msg:="\n   Tracepoint #"||id||" is disabled."
                       DState.Write(msg)
    @@ -1081,7 +1081,7 @@ method resetTracepoints()
            i +:= 1
            }
        if i > 0 then {
    -      # re-construct the traceMask 
    +      # re-construct the traceMask
           UpdateMask()
           }
        return
    @@ -1103,7 +1103,7 @@ initially()
        ReturnCode    := cset(E_Pret || E_Fret || E_Oret)
        traceBehavior := table()
        Operator      := set( "+","-","*","/","\\","[]","++","--","**","<",">",
    -		     ">=","<=","=","==","===","~=","~==","~===",">>=","<<=")
    -   Behavior      := set("start", "enter", "begin","call","resume", 
    +                     ">=","<=","=","==","===","~=","~==","~===",">>=","<<=")
    +   Behavior      := set("start", "enter", "begin","call","resume",
                             "exit", "end","fail","return", "suspend","remove")
     end
    diff --git a/uni/udb/udap/dapcom.icn b/uni/udb/udap/dapcom.icn
    index 3cb71309f..e65a51b16 100644
    --- a/uni/udb/udap/dapcom.icn
    +++ b/uni/udb/udap/dapcom.icn
    @@ -3,21 +3,21 @@
     #
     global sock
     procedure main(argv)
    -	port := (if &features == "MacOS" then "127.0.0.1" else "") || ":" || pop(argv)
    -	every trap("SIGINT" | "SIGHUP" | "SIGPIPE", onExit)
    +    port := (if &features == "MacOS" then "127.0.0.1" else "") || ":" || pop(argv)
    +    every trap("SIGINT" | "SIGHUP" | "SIGPIPE", onExit)
     
    -	every !5 do
    -		if sock := open(port, "n") then
    -			break
    -		else
    -			delay(1000)
    +    every !5 do
    +        if sock := open(port, "n") then
    +            break
    +        else
    +            delay(1000)
     
    -	\sock | stop("failed to connect to ",port, " ", &errortext )
    -	repeat every s := !select([sock, &input]) do
    -		writes(ready(s === sock)) | writes(sock, ready())
    +    \sock | stop("failed to connect to ",port, " ", &errortext )
    +    repeat every s := !select([sock, &input]) do
    +        writes(ready(s === sock)) | writes(sock, ready())
     end
     
     procedure onExit(non)
    -	close(\sock)
    -	stop()
    +    close(\sock)
    +    stop()
     end
    diff --git a/uni/udb/watchpoint.icn b/uni/udb/watchpoint.icn
    index 6b32496a9..f7783d354 100644
    --- a/uni/udb/watchpoint.icn
    +++ b/uni/udb/watchpoint.icn
    @@ -13,8 +13,8 @@ $include "defaults.icn"
     record oldVarInfo(
        fname, # file name
        line,  # line number
    -   value  # variable value 
    -   ) 
    +   value  # variable value
    +   )
     
     #
     # This record keeps information about the watched variable
    @@ -26,7 +26,7 @@ record WatchedVar(
        hitMax,     # integer specifies the number of hits before notifying the user
        hitCount,   # integer counts the total number of watchpoint hits
        missCount,  # integer counts the total number of watchpoint misses
    -   state,      # integer code of (ENABLED, DISABLED, or DELETED) 
    +   state,      # integer code of (ENABLED, DISABLED, or DELETED)
        op,         # the operation used in the watch condition
        catchValue, # the value that user wants to catch (watched) value of interes
        watchType,  # watchType = (WASSIGN | WVALUECHANGE | WTYPECHANGE | WREAD)
    @@ -46,16 +46,16 @@ class WatchPoint(
        varInfo,    # a table tracks information about the watched variables
        id,         # a watchpoint counter
        pname,      # the procedure name of the variable scope
    -   chScope,    # the character scope ("+"|"-"|"^"|":")     
    +   chScope,    # the character scope ("+"|"-"|"^"|":")
        catchValue, # the catched value
        var,        # the variable name as it is seen internally
    -   vname,      # the variable name as its seen by the programmer 
    +   vname,      # the variable name as its seen by the programmer
        initValue,  # the initial value at the time of placing the watchpoint
        oper,       # the relational operation used  for the catchvalue (=|<=|>=|>|<)
        hits,       # the maximum number of watchpoint hits
        watchType,  # watchType = (WASSIGN|WVALUECHANGE|WTYPECHANGE|WREAD)_SILENT
        silent,     # to enable variable tracing, when it is null, traceList os null
    -   msg         # a string with latest message from this class 
    +   msg         # a string with latest message from this class
        )
     
     #
    @@ -66,12 +66,12 @@ class WatchPoint(
     method checkWatchRead()
        local var := &eventvalue
     
    -   if member(DState.watchReadMask,var) & 
    +   if member(DState.watchReadMask,var) &
           varInfo[var].state = ENABLED then {
     
           # static or local and not target coexp
    -      if (not DState.srcFile.isGlobal(varInfo[var].name)) & 
    -         \varInfo[var].coexp & 
    +      if (not DState.srcFile.isGlobal(varInfo[var].name)) &
    +         \varInfo[var].coexp &
              varInfo[var].coexp.id ~= DState.coState.curr.id then fail
     
           if /varInfo[var].hitMax   | varInfo[var].hitMax < 0 |
    @@ -94,17 +94,17 @@ end
     # Check the Monitored file for a watchpoint
     # it is called when either E_Assign or E_Value is the event
     # An E_Value always immediately follows an E_Assign event
    -# 
    +#
     method checkWatchChange( )
        static var, hit := 0, evalue := 0
     
    -   if &eventcode == E_Assign & 
    +   if &eventcode == E_Assign &
           member(DState.watchChangeMask,&eventvalue) &
           varInfo[&eventvalue].state = ENABLED then {
           var := &eventvalue
           # static or local and not target coexp
    -      if (not DState.srcFile.isGlobal(varInfo[var].name)) & 
    -         \varInfo[var].coexp & 
    +      if (not DState.srcFile.isGlobal(varInfo[var].name)) &
    +         \varInfo[var].coexp &
              varInfo[var].coexp.id ~= DState.coState.curr.id then fail
     
           if /varInfo[var].hitMax   | varInfo[var].hitMax < 0 |
    @@ -147,8 +147,8 @@ method checkWatchScan()
        if &eventcode == E_Spos then {
           var := "&pos"
           # static or local and not target coexp
    -      if (not DState.srcFile.isGlobal(varInfo[var].name)) & 
    -         \varInfo[var].coexp & 
    +      if (not DState.srcFile.isGlobal(varInfo[var].name)) &
    +         \varInfo[var].coexp &
              varInfo[var].coexp.id ~= DState.coState.curr.id then fail
     
           if /varInfo[var].hitMax   | varInfo[var].hitMax < 0 |
    @@ -167,8 +167,8 @@ method checkWatchScan()
           var := "&subject"
     
           # static or local and not target coexp
    -      if (not DState.srcFile.isGlobal(varInfo[var].name)) & 
    -         \varInfo[var].coexp & 
    +      if (not DState.srcFile.isGlobal(varInfo[var].name)) &
    +         \varInfo[var].coexp &
              varInfo[var].coexp.id ~= DState.coState.curr.id then fail
     
           if /varInfo[var].hitMax   | varInfo[var].hitMax < 0 |
    @@ -194,7 +194,7 @@ end
     #
     method checkCatchValue(var)
     
    -   if numeric(varInfo[var].curValue) & 
    +   if numeric(varInfo[var].curValue) &
           numeric(varInfo[var].catchValue) then {
           case varInfo[var].op of {
              "=":{
    @@ -229,7 +229,7 @@ method checkCatchValue(var)
           varInfo[var].missCount +:= 1
           return
           }
    -   else if type(varInfo[var].catchValue) == "string"  &  
    +   else if type(varInfo[var].catchValue) == "string"  &
                                  string(varInfo[var].curValue) then {
           if varInfo[var].watchType = WTYPE then {
              case varInfo[var].op of {
    @@ -246,9 +246,9 @@ method checkCatchValue(var)
                    DState.Write(msg)
                    #printWatchedVarInfo(var)
                    fail   }
    -            } 
    +            }
              }
    -      else { 
    +      else {
              case varInfo[var].op of {
                 "=":{
                    if varInfo[var].curValue == varInfo[var].catchValue then
    @@ -282,7 +282,7 @@ method checkCatchValue(var)
                 }
              }
           varInfo[var].missCount +:= 1
    -      return   
    +      return
           }
        fail
     end
    @@ -294,8 +294,8 @@ end
     method printWatchedVarInfo(var)
     
        # this is for global vars that must be updated outside of target coexp
    -   # current coexp isn't the same as watched coexp, exit 
    -   if DState.srcFile.isGlobal(varInfo[var].name) & \varInfo[var].coexp & 
    +   # current coexp isn't the same as watched coexp, exit
    +   if DState.srcFile.isGlobal(varInfo[var].name) & \varInfo[var].coexp &
           varInfo[var].coexp.id ~= DState.coState.curr.id then fail
     
        if varInfo[var].watchType = (WASSIGN | WSCAN) then {
    @@ -331,7 +331,7 @@ method scanSnapshot(p, len)
        /len := 40
        prefix   := "\n   &subject  : "
        pad := *prefix - 2 - 2
    - 
    +
        if size <= len then {
           pad +:= p #- 3
           prefix ||:= subject
    @@ -393,7 +393,7 @@ method printInfo(var)
               " : "||type(varInfo[var].curValue)
        if var == "&pos" then {
           msg ||:= scanSnapshot(varInfo[var].curValue)
    -      } 
    +      }
        msg||:="\n   --------------------------------------------------"
        msg||:="\n   Watchpoint #" ||varInfo[var].id||" on: "||var||"; "||
                  cur_file||":"||cur_line|| " coexp "||DState.coState.curr.id||"."
    @@ -411,7 +411,7 @@ end
     
     #
     # private method
    -# triggered at the end of a count watch, 
    +# triggered at the end of a count watch,
     # it notfies the user that there is no more watching
     #
     method showEndWatchInfo(var)
    @@ -420,7 +420,7 @@ method showEndWatchInfo(var)
        DState.State := PAUSE
        DState.RunCode := WATCH
     
    -   if varInfo[var].hitMax > 0 then { 
    +   if varInfo[var].hitMax > 0 then {
           msg   :="\n   Reaching the last of "||varInfo[var].hitCount||" hits"
           if \varInfo[var].silent then {
              msg ||:=" of:"
    @@ -431,10 +431,10 @@ method showEndWatchInfo(var)
           }
        else
           msg := ""
    -   msg ||:="\n   Do you want to display previous info (Y|n)? : " 
    +   msg ||:="\n   Do you want to display previous info (Y|n)? : "
        DState.Writes(msg)
        if *(ans := DState.stateRead()) = 0 | ans == ("y"|"Y"|"yes"|"YES") then {
    -      if varInfo[var].hitMax > 0 then { 
    +      if varInfo[var].hitMax > 0 then {
              msg :="\n   --------------------------------------------------"
              every i := 1 to *varInfo[var].traceList do {
                 r := varInfo[var].traceList[i]
    @@ -545,7 +545,7 @@ method buildInternalVarName(cmd)
                 }
              }
           else {
    -         msg   :="\n   Setting a watchpoint is failed;" 
    +         msg   :="\n   Setting a watchpoint is failed;"
              msg ||:="\n   \""||pname||"\" is not procedure in the current binary."
              DState.Write(msg)
              fail
    @@ -553,16 +553,16 @@ method buildInternalVarName(cmd)
           }
        else { #watch var
           if DState.State = PAUSE then {
    -	 # proc name is the current symbol table (scope) label
    +         # proc name is the current symbol table (scope) label
              pname := DState.srcFile.curr_symtab.label
              if (ntype := DState.srcFile.getNameType(var)) then {
                 case ntype of {
    -               "local": { var ||:= "-" || pname } 
    -               "param": { var ||:= "^" || pname } 
    -               "static": { var ||:= ":" || pname } 
    +               "local": { var ||:= "-" || pname }
    +               "param": { var ||:= "^" || pname }
    +               "static": { var ||:= ":" || pname }
                    "global": { var ||:= "+" } # globals aren't a part of any proc
                    default: { debug("got ",var," ",ntype)
    -                  msg   :="\n   Fail to set watchpoint." 
    +                  msg   :="\n   Fail to set watchpoint."
                       msg ||:="\n   \""||var||"\" not found."
                       DState.Write(msg)
                       fail
    @@ -575,8 +575,8 @@ method buildInternalVarName(cmd)
     end
     
     #
    -# private method 
    -# retrieves a symbolic name for the watching type  
    +# private method
    +# retrieves a symbolic name for the watching type
     #
     method getWatchTypeName(varRec)
        local watchname:="whenever "
    @@ -597,8 +597,8 @@ method getWatchTypeName(varRec)
          WSCAN:{
            watchname ||:= "changed"
            }
    -     default:{ 
    -       watchname ||:= "??" 
    +     default:{
    +       watchname ||:= "??"
            }
          }
        if \varRec.op & \varRec.catchValue then
    @@ -609,7 +609,7 @@ method getWatchTypeName(varRec)
              watchname ||:=",(First "||varRec.hitMax||" hits)."
           else
              watchname ||:=",(Last "||abs(varRec.hitMax)||" hits are traceable)."
    -      } 
    +      }
        else
           watchname ||:=""
     
    @@ -635,8 +635,8 @@ method addWatchpoint(coexp)
     
        #WatchedVar(name,id,silent,hitMax,hitCount,missCount,state,op,catchValue,
        #           watchType, initValue, oldValue, curValue, traceList, cmd, coexp)
    -   varInfo[var] := 
    -     WatchedVar(vname, (\old_id|id), silent, hits, 0, 0, ENABLED, oper, 
    +   varInfo[var] :=
    +     WatchedVar(vname, (\old_id|id), silent, hits, 0, 0, ENABLED, oper,
                     catchValue,watchType,initValue, initValue, initValue, ,
                     DState.cmdHistory[1], coexp)
     
    @@ -660,20 +660,20 @@ end
     #
     method cmdWatch(cmd)
        local ans, coexp, resultTable := table()
    -   
    +
        if not isOKcmdWatch() then fail
    -   
    +
        initNewCmd()
     
        # check for [coexp N]
        if *cmd >= 4 & cmd[-2] == "coexp" then {
           if /(coexp := DState.coState.get_coexp(cmd[-1])) then {
    -	 DState.State := ERROR
    +         DState.State := ERROR
              msg := "\n   "||cmd[-2]||" "||cmd[1]||" does not exist."||
    -	        "\n   Use command \"coexp\" to view activated co-expressions."
    +                "\n   Use command \"coexp\" to view activated co-expressions."
              DState.Write(msg)
              fail
    -         } 
    +         }
           until pull(cmd) == "coexp"
           }
     
    @@ -691,7 +691,7 @@ method cmdWatch(cmd)
           printWatchInfo(cmd)
           return
           }
    -      
    +
        if not resolveWatchType(cmd) then {
           DState.State := ERROR
           msg   := "\n   Undefined Command: \""|| DState.cmdHistory[1] ||"\"" ||
    @@ -724,7 +724,7 @@ method cmdWatch(cmd)
              }
           else {
              addWatchpoint(coexp)
    -         } 
    +         }
           return
           }
        else fail
    @@ -739,13 +739,13 @@ method constructWpMsg(var)
        msg||:=varInfo[var].id||" on: "||var
     
        if \varInfo[var].coexp then
    -      msg ||:= " coexp " || varInfo[var].coexp.id 
    +      msg ||:= " coexp " || varInfo[var].coexp.id
     
        msg||:="; "||
               getWatchTypeName(varInfo[var])||"("||
               getWatchState(varInfo[var].state)||")"
     
    -   return msg 
    +   return msg
     end
     
     #
    @@ -779,7 +779,7 @@ method printWatchInfo(cmd)
                       if \varInfo[x].traceList & *varInfo[x].traceList > 0 then {
                          printOldInfo(x)
                          return
    -                     } 
    +                     }
                       break
                       }
                    }
    @@ -799,7 +799,7 @@ method printWatchInfo(cmd)
           }
     
        if *msg = 0 then
    -      msg :="\n   No watchpoints available." 
    +      msg :="\n   No watchpoints available."
        DState.Write(msg)
     end
     
    @@ -809,7 +809,7 @@ end
     #
     method printOldInfo(var)
        local i, r, max
    -   
    +
        if \varInfo[var].traceList then {
           msg  :="\n   Command   : " ||varInfo[var].cmd
           msg||:="\n   hit  total: " ||varInfo[var].hitCount
    @@ -823,7 +823,7 @@ method printOldInfo(var)
              max := abs(varInfo[var].hitMax)
           if /max | max > *varInfo[var].traceList then
              max := *varInfo[var].traceList
    -       
    +
           every i := 1 to max do {
              r := varInfo[var].traceList[i]
              msg||:="\n   "||i||"# at "||r.fname||":"||r.line||
    @@ -871,7 +871,7 @@ method cmdClear(cmd)
              DState.Write(msg)
              }
           else {
    -	 setWatchType(cmd[2], WASSIGN)
    +         setWatchType(cmd[2], WASSIGN)
              every x := key(varInfo) do {
                 if varInfo[x].watchType = watchType then {
                    delete(varInfo, x)
    @@ -937,7 +937,7 @@ method cmdDelete(cmd)
              DState.Write(msg)
              }
           else {
    -	 setWatchType(cmd[2], WASSIGN)
    +         setWatchType(cmd[2], WASSIGN)
              every x := key(varInfo) do {
                 if varInfo[x].watchType = watchType &
                    varInfo[x].state    ~= DELETED     then {
    @@ -972,7 +972,7 @@ method cmdDelete(cmd)
                    DState.Write(msg)
                    fail
                    }
    -            } 
    +            }
              }
           msg:="\n   Watchpoints # "||id|| " is not available to be deleted."
           DState.Write(msg)
    @@ -1007,7 +1007,7 @@ method cmdEnable(cmd)
              DState.Write(msg)
              }
           else {
    -	 setWatchType(cmd[2], WASSIGN)
    +         setWatchType(cmd[2], WASSIGN)
              every x := key(varInfo) do {
                 if varInfo[x].watchType = watchType &
                    varInfo[x].state     = DISABLED then {
    @@ -1034,7 +1034,7 @@ method cmdEnable(cmd)
                    return
                    }
                 else {
    -	       msg := "\n   Watchpoint #"||id||" is "
    +               msg := "\n   Watchpoint #"||id||" is "
                    if varInfo[x].state = ENABLED then
                       msg := "already enabled."
                    else
    @@ -1077,7 +1077,7 @@ method cmdDisable(cmd)
              DState.Write(msg)
              }
           else {
    -	 setWatchType(cmd[2], WASSIGN)
    +         setWatchType(cmd[2], WASSIGN)
              every x := key(varInfo) do {
                 if varInfo[x].watchType = watchType &
                    varInfo[x].state     = ENABLED then {
    @@ -1104,7 +1104,7 @@ method cmdDisable(cmd)
                    return
                    }
                 else {
    -	       msg := "\n   Watchpoint #"||id||" is "
    +               msg := "\n   Watchpoint #"||id||" is "
                    if varInfo[x].state = DISABLED then
                       msg ||:= "already disabled."
                    else
    @@ -1177,7 +1177,7 @@ method resetWatchpoints()
        if i > 0 then {
           self.id := 0
           }
    -   return 
    +   return
     end
     
     #
    @@ -1193,7 +1193,7 @@ end
     # Initialization
     #
     initially()
    -   varInfo := table() # maps var into WatchedVar() 
    +   varInfo := table() # maps var into WatchedVar()
        id   := 0
        msg := ""
     end
    
    From 7218a0c589b3844b114f1cfcc236355508fa18d8 Mon Sep 17 00:00:00 2001
    From: Don Ward 
    Date: Sun, 10 Mar 2024 15:49:15 +0000
    Subject: [PATCH 7/7] Convert tabs to spaces (uni/ulsp).
    
    ---
     uni/ulsp/database.icn | 4 ++--
     uni/ulsp/server.icn   | 6 +++---
     2 files changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/uni/ulsp/database.icn b/uni/ulsp/database.icn
    index 3606b90a3..ba3143be7 100644
    --- a/uni/ulsp/database.icn
    +++ b/uni/ulsp/database.icn
    @@ -56,9 +56,9 @@ class LSPDB(
                        "&row", "&rpress", "&rrelease", "&shift", "&source", "&storage", "&subject",
                        "&time", "&trace", "&ucase", "&version", "&window", "&x", "&y"]
     
    -		preprocessors := ["$define", "$else", "$endif", "$error", "$ifdef", "$ifndef",
    +        preprocessors := ["$define", "$else", "$endif", "$error", "$ifdef", "$ifndef",
                                       "$include", "$line", "$undef", "#line"]
    -	end
    +    end
     
        method build_bnf()
           local idoc, dirPath, source_table, source_file, _procedure, param_in_procedure, paramName, paramType, paramDef
    diff --git a/uni/ulsp/server.icn b/uni/ulsp/server.icn
    index afb4910b1..9b1db87d3 100644
    --- a/uni/ulsp/server.icn
    +++ b/uni/ulsp/server.icn
    @@ -255,10 +255,10 @@ class Server(
     #                  $/cancelRequest                     #
     ########################################################
     # TODO:
    -# 	One thread for communication
    -# 	Spin up thread(s) for processing requests and tie request_id to thread
    +#       One thread for communication
    +#       Spin up thread(s) for processing requests and tie request_id to thread
     # Handling cancel requests:
    -#	kill thread associated with request_id
    +#       kill thread associated with request_id
     
        method cancelRequest(request_id)
           write("We received a cancel request. We need to implement this still...")