1. Confusing Coding Conundrum
- Posted by Travis Beaty <atora at xoommail.com> Aug 17, 2000
- 443 views
Hello All! As some of you may be aware, I've been working an IDE for Euphoria. Since the project is finally starting to come together somewhat, I suppose it is time to announce its development publicly. The name that I have chosen for it is "Vision Euphoria" -- I would really liked to have called it "Visual Euphoria," but that name has been taken. It will be a fairly large and complex program, and it will not be completed until some time in November, thanks to my hectic schedule; however, at least now the program is not 99% vaporware. The completed package will be shareware, and the price will be under $30 -- completely honor based (no nag screens or broken code). Vision Euphoria will consist of a core program, assisted by various support programs that (hopefully) will make programming in win32lib.ew and Euphoria in general very easy. One such "support program" is the Euphoria Database Editor, which assists in the formation and editing of files created using database.e. It is now 80% operational, and should be available for download (all support programs will be freeware) within the next two weeks. I have a little bit of coding left, as well as some brief documentation ... its comprehensive documentation will be packaged with Vision Euphoria. The program is very straightforward and simple, and even without a 150 page manual, it should be understandable to anyone vaguely familiar with Euphoria. I have a confusing problem at this point, however, and I'm hoping that somebody out there in Euphorialand can point me in the right direction. Within EDB, I have a find feature, which allows the user to find either Euphoria strings or objects (integers, sequences, atoms, etc.) I've gotten the program to find any object as long as it's not nested in a layer of sequences, but I'm having a problem accurately displaying its location. The object displayed in the data mle has been sprint'ed so that it can be shown. When the program finds a match for the search object, it needs to be highlighted (selected). Thanks to information graciously supplied by Mr. Fritz, I have a mechanism to highlight. But I can't figure out how to convert the position of the match into its position within the sprint'ed object. Example: TheDarnObject: {23,45,65,71,33,14,19, {30,30,32},12,16,4,0} User wants to find: 16 -------------------------- --^ Now then, my first approach would be to get the index of the matched element, in this case 10, then count the commas in the sprinted version. One I got to the ninth one, just one position over and there it is. But the nested sequence bites me in the backside, as I would need to factor in the nested sequence's length. Not a problem for this example. But what if there are dozens of layers of nested sequences? No good. If someone can help me out, it would be very appreciated! The answer is more than likely right there in front of me, and I'm too flustered to see it. At any rate, as soon as I get this problem solved, and throw in some printing code, she'll be ready to go! Travis Beaty Claude, Texas ----- "The fastest line is the one that you're not in." -- Murphy's Law ______________________________________________________ Get your free web-based email at http://www.xoom.com Birthday? Anniversary? Send FREE animated greeting cards for any occasion at http://greetings.xoom.com
2. Re: Confusing Coding Conundrum
- Posted by Undetermined origin c/o LISTSERV administrator Aug 17, 2000
- 378 views
--------------1349434434EE8BA264FD3604 Travis Beaty wrote: > Hello All! > > As some of you may be aware, I've been working an > IDE for Euphoria. Since the project is finally > starting to come together somewhat, I suppose it > is time to announce its development publicly. > The name that I have chosen for it is "Vision > Euphoria" -- I would really liked to have called > it "Visual Euphoria," but that name has been > taken. It will be a fairly large and complex > program, and it will not be completed until some > time in November, thanks to my hectic schedule; > however, at least now the program is not 99% > vaporware. The completed package will be > shareware, and the price will be under $30 -- > completely honor based (no nag screens or broken > code). > > Vision Euphoria will consist of a core program, > assisted by various support programs that > (hopefully) will make programming in win32lib.ew > and Euphoria in general very easy. One > such "support program" is the Euphoria Database > Editor, which assists in the formation and > editing of files created using database.e. It is > now 80% operational, and should be available for > download (all support programs will be freeware) > within the next two weeks. I have a little bit > of coding left, as well as some brief > documentation ... its comprehensive documentation > will be packaged with Vision Euphoria. The > program is very straightforward and simple, and > even without a 150 page manual, it should be > understandable to anyone vaguely familiar with > Euphoria. > > I have a confusing problem at this point, > however, and I'm hoping that somebody out there > in Euphorialand can point me in the right > direction. > > Within EDB, I have a find feature, which allows > the user to find either Euphoria strings or > objects (integers, sequences, atoms, etc.) I've > gotten the program to find any object as long as > it's not nested in a layer of sequences, but I'm > having a problem accurately displaying its > location. > > The object displayed in the data mle has been > sprint'ed so that it can be shown. When the > program finds a match for the search object, it > needs to be highlighted (selected). Thanks to > information graciously supplied by Mr. Fritz, I > have a mechanism to highlight. But I can't > figure out how to convert the position of the > match into its position within the sprint'ed > object. > > Example: > > TheDarnObject: {23,45,65,71,33,14,19, > {30,30,32},12,16,4,0} > > User wants to find: 16 -------------------------- > --^ > > Now then, my first approach would be to get the > index of the matched element, in this case 10, > then count the commas in the sprinted version. > One I got to the ninth one, just one position > over and there it is. But the nested sequence > bites me in the backside, as I would need to > factor in the nested sequence's length. Not a > problem for this example. But what if there are > dozens of layers of nested sequences? No good. > > If someone can help me out, it would be very > appreciated! The answer is more than likely > right there in front of me, and I'm too flustered > to see it. At any rate, as soon as I get this > problem solved, and throw in some printing code, > she'll be ready to go! > > Travis Beaty > Claude, Texas > > ----- > > "The fastest line is the one that you're not in." > > -- Murphy's Law > > ______________________________________________________ > Get your free web-based email at http://www.xoom.com > Birthday? Anniversary? Send FREE animated greeting > cards for any occasion at http://greetings.xoom.com You could use a modified version of sprint which returns the starting and ending indexes of a particular element, or you could search through the resulting string and keep track of the depth of nested sequences. I've attached a modified version of sprint. It probably could be a little faster or cleaner, but it works (included are a few tests). Note that it still requires sprint. Jeff Fielding JJProg at cyberbury.net --------------1349434434EE8BA264FD3604 name="sprint2.e" Content-Disposition: inline; filename="sprint2.e" include misc.e global function sprint2(object x, object index) -- Return the string representation of any Euphoria data object. -- This is the same as the output from print(1, x) or '?', but it's -- returned as a string sequence rather than printed. -- modified by Jeff Fielding to return the indexes of the object too sequence s, temp integer startIndex, endIndex if atom(x) then s = sprintf("%.10g",x) return {s, 1, length(s)} else s = "{" if sequence(index) then for i = 1 to length(x) do if index[1] = i then temp = index[2..length(index)] if length(temp) then temp = sprint2(x[i],temp) startIndex = length(s)+temp[2] endIndex = length(s)+temp[3] s &= temp[1] else startIndex = length(s)+1 s &= sprint(x[i]) endIndex = length(s) end if else s &= sprint(x[i]) end if if i < length(x) then s &= ',' end if end for else for i = 1 to length(x) do if index = i then startIndex = length(s)+1 temp = sprint(x[i]) endIndex = length(s)+length(temp) s &= temp else s &= sprint(x[i]) end if if i < length(x) then s &= ',' end if end for end if s &= "}" return {s, startIndex, endIndex} end if end function constant C = {1,2,{3,{4}}} procedure p(object index) sequence t puts(1,"index: ") print(1,index) t = sprint2(C,index) puts(1,"\n" & t[1] & "\n") for i = 1 to t[2]-1 do puts(1,' ') end for for i = t[2] to t[3] do puts(1,'^') end for puts(1,'\n') end procedure p(1) p(2) p(3) p({1}) p({3,1}) p({3,2}) p({3,2,1}) --------------1349434434EE8BA264FD3604--
3. Re: Confusing Coding Conundrum
- Posted by "Darth Maul, aka Matt" <Uglyfish87 at HOTMAIL.COM> Aug 17, 2000
- 451 views
- Last edited Aug 18, 2000
A while back, a band called "Pray for Rain" started, but the name had already been taken, so they changed it to PFR(or PfR), which they claim had absolutely no meaning. Maybe you could call your IDE VE, or Euphoria Visual.