1. Standard toolkit
- Posted by Jason Gade <jaygade at yahoo.com> Jul 01, 2005
- 764 views
Can anyone tell me what (non-RDS) library files besides Win32Lib that they use regularly in their projects? I'm mostly asking about utility functions, not graphics libraries and such. Stuff like print.e, sprint.e, tk_*.e, etc. Include your own libraries that you may not have released to the archive. Some other questions: * If this library is in the archive and you're a registered user, have you voted microbucks for it? * If this library is not in the archive, why not? ===================================== Too many freaks, not enough circuses. j.
2. Re: Standard toolkit
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 02, 2005
- 677 views
On Fri, 01 Jul 2005 07:35:22 -0700, Jason Gade <guest at RapidEuphoria.com> wrote: >Can anyone tell me what (non-RDS) library files besides Win32Lib that they use >regularly in their projects? >I'm mostly asking about utility functions, not graphics libraries and such. That would be arwen you are not asking about then ) >Stuff like print.e, sprint.e, tk_*.e, etc. Include your own libraries >that you may not have released to the archive. The main ones for me are: syswait ppp ipc (though that is getting less used by me, personally) I also use reg.ew (by Davi Tassinari de Figueiredo), though I would prefer a read-only subset (ie just tell me what is the associated editor/browser/email client, etc) They are all in the archive. There is other stuff, like min, max, abs, which I tend to just copy, because I don't have a trusted, slimline, source. I also have at least four versions (each) of upper and lower, common memory (re-) allocation, string, stringify, Abort (erm make that 30+ versions), Focus (one good idea on that one), database.e wrappers, ..... Regards, Pete
3. Re: Standard toolkit
- Posted by Jason Gade <jaygade at gmail.com> Jul 02, 2005
- 664 views
Pete Lomax wrote: > > > On Fri, 01 Jul 2005 07:35:22 -0700, Jason Gade > <guest at RapidEuphoria.com> wrote: > > >>Can anyone tell me what (non-RDS) library files besides Win32Lib that they use >>regularly in their projects? >>I'm mostly asking about utility functions, not graphics libraries and such. > > That would be arwen you are not asking about then ) > > >>Stuff like print.e, sprint.e, tk_*.e, etc. Include your own libraries >>that you may not have released to the archive. > > The main ones for me are: > syswait > ppp > ipc (though that is getting less used by me, personally) > > I also use reg.ew (by Davi Tassinari de Figueiredo), though > I would prefer a read-only subset (ie just tell me what is the > associated editor/browser/email client, etc) > > They are all in the archive. > > There is other stuff, like min, max, abs, which I tend to just > copy, because I don't have a trusted, slimline, source. > I also have at least four versions (each) of upper and lower, > common memory (re-) allocation, string, stringify, Abort (erm > make that 30+ versions), Focus (one good idea on that one), > database.e wrappers, ..... > > Regards, > Pete I haven't looked much at Arwen. Is it a good example of a library? I mean just looking at how the API is exposed to the user and how the functions are written. Can the code be used as an example of how to write *any* library? Arwen is Windows-specific, isn't it? Just wondering because if a set of libraries is recommended as a standard "user toolkit" it should be cross-platform. That's why I was thinking that wxEuphoria would be a good recommendation for gui/networking toolkit. I know that Win32Lib is much more mature but it is Windows-specific (for now). I still think that it is probably a good example of how a library *should* be written but I could be wrong since I haven't examined it extensively either. As per Christian Cuvier's suggestion I am kind of surveying what kind of library routines are currently used by programmers in Euphoria. I think that is a good start towards a user toolkit/recommended set of add-on routines that everyone should have available. -- ============================== Too many freaks, not enough circuses. j.
4. Re: Standard toolkit
- Posted by Al Getz <Xaxo at aol.com> Jul 02, 2005
- 680 views
Jason Gade wrote: > > Can anyone tell me what (non-RDS) library files besides Win32Lib that they use > regularly > in their projects? I'm mostly asking about utility functions, not graphics > libraries > and such. Stuff like print.e, sprint.e, tk_*.e, etc. Include your own > libraries that > you may not have released to the archive. > > Some other questions: > > * If this library is in the archive and you're a registered user, have you > voted microbucks > for it? > > * If this library is not in the archive, why not? > > ===================================== > Too many freaks, not enough circuses. > > j. > Hi there Jason, There's also the "WinClass" C++ style library, which is easier to modify than some of the big single file libraries. It's also organized better in a class hierarchical order, does COM/Ole (has interfaces already too), and already has many custom classes. The COM structure is the simplest found anywhere on the web i believe. The version right now in the archive is the older version. The new version, complete with almost every Windows class there is, is due out around the middle of next week. The new classes round out the library quite nicely: Treeview, Listview, Scrollbars, Trackbars, Rebar, Updown, TabControl, PropertySheet, Toolbars, Calendar, AppointmentBook, Progressbars, Marquee, as well as "Long Operation" support which is multi thread-like. Unlike Microsoft's standard Marquee Control, the WinClass Marquee Control works on all systems Win95,98, etc., not just XP, and of course can be geared with it's own thread-like operation. The PropertySheet Control is easy to use too...almost like creating a window with child windows. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
5. Re: Standard toolkit
- Posted by akusaya at gmx.net Jul 02, 2005
- 687 views
J> Can anyone tell me what (non-RDS) library files besides J> Win32Lib that they use regularly in their projects? I'm mostly J> asking about utility functions, not graphics libraries and such. J> Stuff like print.e, sprint.e, tk_*.e, etc. Include your own J> libraries that you may not have released to the archive. J> Some other questions: J> * If this library is in the archive and you're a registered J> user, have you voted microbucks for it? J> * If this library is not in the archive, why not? Having used Eu for 5 years, nearly all projects I made always include a file I made as standard library. So I think Eu standard library is very important. So I translated the include file to English and removed a lot of routines that I think would not be too useful for the others. The file is below. Some of the routines are obtained from Euforum, but sorry I didn't keep the original author names. A lot of routines are still missing. I think these routines need to be included in the standard library project: - copy/rename/move/delete/rmdir functions, USING WIN32 API and LINUX SYSTEM CALLS instead of system("del " & filename,0) which I hate very much (personally) since it's not reliable - *simple* hash map/set, like hash_set(key, value), hash_get(key, default_value), hash_find(key), etc - date/time library, like datetime.e by CyrekSoft If you think that my file below is suitable for inclusion, please include it in the Std Library project, but since there is some performance problems, please optimize it. Looking forward for your suggestions, etc! -- Standard Library ... by Aku 2000-2004 -- Renewed in 2005 to use English and for general public -- Removed a lot of unused routines include dll.e include get.e include wildcard.e include file.e --------------------------------------------------------------------- --------------------------------------------------------------------- object pppath if platform() = 3 then pppath = '/' else pppath = '\\' end if object xGetTickCount, xSleep if platform() = WIN32 then xGetTickCount = define_c_func(open_dll("kernel32"), "GetTickCount", {}, C_LONG) xSleep = define_c_proc(open_dll("kernel32"), "Sleep", {C_ULONG}) end if --------------------------------------------------------------------- --# String / Sequence --------------------------------------------------------------------- -- left(string st, int n) -- same as left() on VB, returns the first /n chars of st, if /n > length(/st) -- then /st is returned global function left(sequence st, atom n) if n >= length(st) then return st else return st[1..n] end if end function -- mid(string st, int start, int len) -- same as mid() on VB, returns the /len chars of /st starting from -- position /start. If /len = -1, /st[/start..length(/st)] is returned. global function mid(sequence st, atom start, atom len) if start > length(st) then return "" elsif len = 0 or len <= -2 then return "" elsif start+len-1 > length(st) then return st[start..length(st)] elsif len = -1 then return st[start..length(st)] elsif len+start-1 < 0 then return "" elsif start < 1 then return st[1..len+start-1] else return st[start..len+start-1] end if end function -- slice(string st, int start, int stop) -- returns /st[/start../stop] but takes care of invalid subscript global function slice(sequence st, atom start, atom stop) if stop = -1 then stop = length(st) end if if start < 1 then start = 1 end if if stop > length(st) then stop = length(st) end if if start > stop then return "" end if return st[start..stop] end function -- vslice(sequence s, int colno) -- vertical slicing -- for example, if /s = {{1,2}, {3,4}} and /colno = 2, -- then vslice(s, colno) = {2,4} global function vslice(sequence s, atom colno) sequence ret ret = {} for i = 1 to length(s) do ret = append(ret, s[i][colno]) end for return ret end function -- right(string st, int n) -- same as right() on VB, returns the last /n chars of st, if /n > length(/st) -- then /st is returned global function right(sequence st, atom n) if n >= length(st) then return st else return st[length(st)-n+1..length(st)] end if end function -- instr(int start, string st1, string st2) -- same as instr() in VB -- Basically it's match(st2, /st1[start..length(/st1)]), -- but if st2 = "", will return 1 global function instr(atom start, sequence st1, sequence st2) integer pos if start > length(st1) then return 0 elsif equal(st2, {}) then return 1 else pos = match(st2, st1[start..length(st1)]) if pos then return pos + start - 1 else return 0 end if end if end function -- instr_nc(int start, string st1, string st2) -- non case sensitive version of instr() global function instr_nc(atom start, sequence st1, sequence st2) return instr(start, lower(st1), lower(st2)) end function -- split(string st, string delim) -- splits /st to sequence of strings -- example: split("abacbabacaaba", "ba") = {"a", "c", "", "caa", ""} global function split(sequence st, sequence delim) sequence ret object pos ret={} while 1 do pos = match(delim, st) if pos then ret = append(ret, st[1..pos-1]) st = st[pos+length(delim)..length(st)] else exit end if end while ret = append(ret, st) return ret end function -- join(sequence s, string delim) -- joins /s to the original string -- example: join({"1", "23"}, "_") = "1_23" global function join(sequence s, object delim) object ret if not length(s) then return "" end if ret = "" for i=1 to length(s)-1 do ret &= s[i] & delim end for ret &= s[length(s)] return ret end function -- replace(string st, string sfind, string sreplace) -- replaces every occurence of /sfind in /st with /sreplace global function ganti(sequence st, sequence sfind, sequence sreplace) atom pos, a pos = 1 while 1 do a = instr(pos, st, sfind) if not a then exit end if st = st[1..a-1] & sreplace & st[length(sfind)+a..length(st)] pos = a+length(sreplace) end while return st end function -- part(sequence s, int pos) -- simply returns /s[/pos] with error handling -- useful for emulating: func(something)[pos] which is not a legal syntax in eu -- in that case, use: part(func(something), pos) global function part(object s, atom pos) if atom(s) then return s end if if length(s) = 0 then return 0 end if if pos > length(s) then return s[length(s)] end if if pos < 1 then return s[1] end if return s[pos] end function -- remove_dup(sequence s) -- remove duplicates in s global function remove_dup(sequence s) object mark, ret mark = repeat(1, length(s)) for i = 1 to length(s)-1 do for j = i+1 to length(s) do if equal(s[i], s[j]) then mark[j] = 0 end if end for end for ret = {} for i = 1 to length(mark) do if mark[i] then ret = append(ret, s[i]) end if end for return ret end function -- seq_insert(int at, sequence s, object new) -- inserts /new at position /at to /s global function seq_insert(integer at, sequence s, object new) s &= 0 s[at+1..length(s)] = s[at..length(s)-1] s[at] = new return s end function -- seq_remove(object at, sequence s) -- removes element(s) in position(s) /at from /s -- /at can be an int or an {int from, int to} global function seq_remove(object at, sequence s) if atom(at) then at = {at,at} end if s = s[1..at[1]-1] & s[at[2]+1..length(s)] return s end function -- shuffle(sequence s) -- changes the order of elements of /s randomly global function shuffle(sequence s) object temp integer j for i = length(s) to 2 by -1 do j = rand(i) temp = s[j] s[j] = s[i] s[i] = temp end for return s end function -- find_all(sequence s, object sfind) -- returns positions of matching elements -- example: find_all({1,9,3,9,9}, 9) = {2,4,5} global function find_all(sequence s, object ofind) object ret ret = {} for i=1 to length(s) do if equal(ofind, s[i]) then ret &= i end if end for return ret end function -- vfind(object ofind, sequence o, atom colno) -- vertical find. -- finds /sfind in column /colno of /o global function vfind(object ofind, sequence o, atom colno) for i=1 to length(o) do if equal(ofind, o[i][colno]) then return i end if end for return 0 end function -- trim(string st) -- removes \n, \r, \t, and spaces from beginning and end of /st global function trim(sequence st) object p p = 0 for i = 1 to length(st) do if find(st[i], "\n\r\t ") then p = i else exit end if end for st = st[p+1..length(st)] p = length(st)+1 for i = length(st) to 1 by -1 do if find(st[i], "\n\r\t ") then p = i else exit end if end for st = st[1..p-1] return st end function -- is_string(object o) -- determines whether /o is a sequence with atom (>=32 and <=255) -- or in "\n\r\t" as its elements global function is_string(object o) if sequence(o) then for i=1 to length(o) do if sequence(o[i]) then return 0 elsif not ((o[i] >= 32 and o[i] <= 255) or find(o[i], "\n\r\t")) then return 0 end if end for return 1 end if return 0 end function --------------------------------------------------------------------- --# Pretty Printing --------------------------------------------------------------------- object euob_tmp procedure euob_makeString(object o) sequence ret ret = "\"" for i = 1 to length(o) do if o[i] = '\t' then ret &= "\\t" elsif o[i] = '\n' then ret &= "\\n" elsif o[i] = '\r' then ret &= "\\r" elsif o[i] = '"' then ret &= "\\\"" elsif o[i] = '\'' then ret &= "\\'" elsif o[i] = '\\' then ret &= "\\\\" else ret &= o[i] end if end for ret &= "\"" euob_tmp &= ret end procedure procedure euob_do(object o) if atom(o) then euob_tmp &= sprintf("%.12g", o) elsif is_string(o) then euob_makeString(o) else euob_tmp &= "{" for i = 1 to length(o) do euob_do(o[i]) if i != length(o) then euob_tmp &= ", " end if end for euob_tmp &= "}" end if end procedure -- euob(object o) -- returns a string representation of an Eu object /o global function euob(object o) euob_tmp = "" euob_do(o) return euob_tmp end function --------------------------------------------------------------------- --# File and I/O --------------------------------------------------------------------- -- file_length(string filename) -- return length of file /filename. -- if not found, returns -1 global function file_length(sequence filename) object list list = dir(filename) if atom(list) or length(list) = 0 then return -1 end if return list[1][D_SIZE] end function -- file_path(string st) -- returns the 'directory' name of a file -- supports \ for win/dos and / for linux/http etc global function file_path(sequence st) object ppdi, ppdi2 st = reverse(st) ppdi = find('\\', st) ppdi2 = find('/', st) if length(find_all('\\', st)) = 1 and st[length(st)] = '\\' then return "\\" elsif length(find_all('/', st)) = 1 and st[length(st)] = '/' then return "/" end if if ppdi=0 and ppdi2=0 then return reverse(st) elsif ppdi=0 then return reverse(st[ppdi2+1..length(st)]) elsif ppdi2=0 then return reverse(st[ppdi+1..length(st)]) elsif ppdi < ppdi2 then return reverse(st[ppdi+1..length(st)]) elsif ppdi2 <= ppdi then return reverse(st[ppdi2+1..length(st)]) end if end function -- file_name(string st) -- returns the 'file' name of a file -- supports \ for win/dos and / for linux/http etc global function file_name(sequence st) object ppdi, ppdi2 st = reverse(st) ppdi = find('\\', st) ppdi2 = find('/', st) if ppdi=0 and ppdi2=0 then return reverse(st) elsif ppdi=0 then return reverse(st[1..ppdi2-1]) elsif ppdi2=0 then return reverse(st[1..ppdi-1]) elsif ppdi < ppdi2 then return reverse(st[1..ppdi-1]) elsif ppdi2 <= ppdi then return reverse(st[1..ppdi2-1]) end if end function -- read_file(object f) -- returns the contents of file /f -- /f can be a filename or a file number as returned by open() -- -1 is returned if failed global function read_file(object f) object fn, ret, kar, len if sequence(f) then len = file_length(f) if len = 0 then return "" elsif len < 0 then return -1 end if ret = repeat(0, len) fn = open(f, "rb") if fn < 0 then return -1 end if for i = 1 to len do ret[i] = getc(fn) end for close(fn) else ret = "" while 1 do kar = getc(f) if kar != -1 then ret &= kar else exit end if end while end if return ret end function -- read_lines(string f) -- get lines of file /f as sequence of strings -- /f can be filename or file number as returned from open() -- \r in end of lines are discarded -- blank lines are ignored -- -1 if failed global function read_lines(sequence f) object fn, ret, y ret = {} if sequence(f) then fn = open(f, "r") else fn = f end if if fn < 0 then return -1 end if while 1 do y = gets(fn) if atom(y) then exit end if if length(y) then if y[length(y)] = '\r' then y = y[1..length(y)-1] end if ret = append(ret, y) end if end while if sequence(f) then close(fn) end if return ret end function -- write_lines(object f, sequence s) -- write lines to file, opposite of read_lines global procedure write_lines(object f, sequence s) object fn if sequence(f) then fn = open(f, "w") else fn = f end if for i=1 to length(s) do puts(fn, s[i]) puts(fn, "\n") end for if sequence(f) then close(fn) end if end procedure -- write_file(object f, string s) -- write all contents to file, opposite of read_file global procedure write_file(object f, sequence s) object fn if sequence(f) then fn = open(f, "wb") else fn = f end if if fn = -1 then return end if puts(fn, s) if sequence(f) then close(fn) end if end procedure -- read_val(int fn) -- reads a Eu object from file number /fn -- equals value(get(/fn))[2] global function getval(atom fn) object temp temp = get(fn) return temp[2] end function -- merge_path(string path, string file) -- merges the /file to its /path. -- example: on win32, merge_path("c:\\abc", "def") = "c:\\abc\\def" -- takes care of excessive slashes global function merge_path(sequence path, sequence file) if length(path) = 0 then return file end if if path[length(path)] = pppath then path = path[1..length(path)-1] end if if length(file) = 0 then return path end if if file[1] = pppath then file = file[2..length(file)] end if return path & pppath & file end function -- file_type(string filename) -- returns 0 if /filename does not exist -- returns 1 if /filename is a file -- returns 2 if /filename is a directory global function file_type(sequence filename) object dirfil if find('*', filename) or find('*', filename) then return 0 end if if length(filename) = 2 and filename[2] = ':' then filename &= "\\" end if dirfil = dir(filename) if sequence(dirfil) then if find('d', dirfil[1][2]) or (length(filename)=3 and filename[2]=':') then return 2 else return 1 end if else return 0 end if end function --------------------------------------------------------------------- --# Sequence Math --------------------------------------------------------------------- -- abs(object o) -- returns absolute value of /o global function abs(object o) return ((o>0)*2-1) * o end function -- sum(object o) -- returns the sum of all atoms in /o and inside /o global function sum(object o) object hs if atom(o) then return o else hs = 0 for i = 1 to length(o) do hs += sum(o[i]) end for end if return hs end function -- max(sequence s) -- returns the index of the element having maximum value global function max(sequence s) object maxi, maxn maxi = 0 maxn = -9e999 for i = 1 to length(s) do if s[i] > maxn then maxn = s[i] maxi = i end if end for return maxi end function -- min(sequence s) -- returns the index of the element having minimum value global function min(sequence s) object mini, minn mini = 0 minn = 9e999 for i = 1 to length(s) do if s[i] < minn then minn = s[i] mini = i end if end for return mini end function -- range(object o, object min, object max) -- returns true if o is between min and max inclusive global function range(object o, object min, object max) return (o >= min) and (o <= max) end function --------------------------------------------------------------------- --# Timing --------------------------------------------------------------------- -- timer() -- functions same as time() but with 1/1000 resolution on Win32 global function timer() if platform() = 2 then return (c_func(xGetTickCount, {})/1000) else return time() end if end function -- stop(atom ms) -- stops execution of the program by /ms milliseconds global procedure stop(atom ms) atom start if ms < 0 then ms = 0 end if if platform() = WIN32 then c_proc(xSleep, {ms}) else start = timer() while 1 do if timer()-start >= (ms/1000) then exit end if end while end if end procedure --------------------------------------------------------------------- --# Misc --------------------------------------------------------------------- -- val(string o) -- returns value(/o)[2] global function val(sequence o) object tp tp = value(o) return tp[2] end function -- iif(atom v, object iftrue, object iffalse) -- Inline if. -- will return /iftrue if /v, or /iffalse if not /v. global function kalo(atom v, object iftrue, object iffalse) if v then return iftrue end if return iffalse end function
6. Re: Standard toolkit
- Posted by Al Getz <Xaxo at aol.com> Jul 02, 2005
- 678 views
Hello aku, Very nice! Now how about submitting to the archive so we can download the whole thing? Thanks, and take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
7. Re: Standard toolkit
- Posted by Jason Gade <jaygade at gmail.com> Jul 02, 2005
- 679 views
Al Getz wrote: > > > posted by: Al Getz <Xaxo at aol.com> > > Jason Gade wrote: > >>Can anyone tell me what (non-RDS) library files besides Win32Lib that they use >>regularly >>in their projects? I'm mostly asking about utility functions, not graphics >>libraries >>and such. Stuff like print.e, sprint.e, tk_*.e, etc. Include your own >>libraries that >>you may not have released to the archive. >> >>Some other questions: >> >>* If this library is in the archive and you're a registered user, have you >>voted microbucks >>for it? >> >>* If this library is not in the archive, why not? >> >>===================================== >>Too many freaks, not enough circuses. >> >>j. >> > > Hi there Jason, > > > There's also the "WinClass" C++ style library, which is easier to > modify than some of the big single file libraries. It's also > organized better in a class hierarchical order, does COM/Ole > (has interfaces already too), and already has many custom classes. > The COM structure is the simplest found anywhere on the web i believe. > > The version right now in the archive is the older version. > The new version, complete with almost every Windows class there is, > is due out around the middle of next week. The new classes round out > the library quite nicely: > > Treeview, Listview, Scrollbars, Trackbars, Rebar, Updown, TabControl, > PropertySheet, Toolbars, Calendar, AppointmentBook, Progressbars, > Marquee, as well as "Long Operation" support which is multi thread-like. > > Unlike Microsoft's standard Marquee Control, the WinClass Marquee Control > works on all systems Win95,98, etc., not just XP, and of course can > be geared with it's own thread-like operation. > > The PropertySheet Control is easy to use too...almost like creating > a window with child windows. > > > Take care, > Al > > And, good luck with your Euphoria programming! > > My bumper sticker: "I brake for LED's" I've browsed the Winclass library and I like what I see. I do wish that Euphoria was more modular -- one of those things that would make OO programming easier. I don't drink the OO koolaid, but I think that it can be a useful technique. It would be cool if it was cross-platform, though. One enhancement for the language itself that can't be done in a library is better handling of includes/imported files and namespaces. I know that has been hashed out ad infinitum ad nauseum on this list. But yet another proposal would be this: include filename works as-is, that is include the file one time only, but if I "include graphics.e" and "include lib/graphics.e" the interpreter should recognize it as different files. But if you "include graphics.e as circle" and then "include graphics.e as square" it would include graphics.e in each different namespace thus simulating objects. Maybe adding an import keyword would work better here, and programmers would have to be careful with top-level statements and nesting includes. Euphoria's method of scoping is there for OO type programming but the namespace and include mechanism isn't. But I don't see any changes there any time soon. Anyway, I do like the technique used in the Winclass library and I look forward to checking out the next version. -- ============================== Too many freaks, not enough circuses. j.
8. Re: Standard toolkit
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 03, 2005
- 692 views
On Fri, 01 Jul 2005 18:22:31 -0700, Jason Gade <jaygade at gmail.com> wrote: >I haven't looked much at Arwen. Is it a good example of a library? I >mean just looking at how the API is exposed to the user and how the >functions are written. Can the code be used as an example of how to >write *any* library? Yes. I would definitely say it is well written, small, and fast. The code is not especially well commented, though I find it quite easy to follow. The docs are certainly much easier to digest that (say) the win32lib ones, but that may well have something to do with arwen having maybe one fifth the functionality of the latter (I've had to add stuff to get Edita to where it is). >Arwen is Windows-specific, isn't it? Yes. I would [also] say arwen is an excellent way to learn how to use the windows API directly, but maybe I am biased because I have been modifying it as well as/while using it. > >Just wondering because if a set of libraries is recommended as a >standard "user toolkit" it should be cross-platform. That's why I was Just because something is not xplat should not be a reason for refusing to recommending it. As a bad example, perhaps, I use dir (or Explorer) on Windows and ls (or Konqueror) on Linux. Depends.exe is strictly windows-only, since it examines .dll files, but should still feature somewhere on any recommended utility list. Sure, put these things lower down the list, but don't exclude them. >thinking that wxEuphoria would be a good recommendation for >gui/networking toolkit. I know that Win32Lib is much more mature but it >is Windows-specific (for now). I still think that it is probably a good >example of how a library *should* be written but I could be wrong since >I haven't examined it extensively either. Win32lib is indeed stable and feature rich. However I don't think anyone would actually say it should be used as an *example* of how a library *should* be written. That is not the same as saying there is no high-quality code in there, but *starting* a new library, I can't imagine a worse way than attempting to copy win32lib. (I may be talking at cross purposes here; the exposed API of win32lib is in general exceptional.) One of the things about well-written code is that it is highly subjective. In fact, the sole purpose of attempting to craft well-written code is that more people can readily understand it. I will be interested in reviewing whatever you finally declare is well-written. >As per Christian Cuvier's suggestion I am kind of surveying what kind of >library routines are currently used by programmers in Euphoria. I think >that is a good start towards a user toolkit/recommended set of add-on >routines that everyone should have available. CK has a section on his web page devoted to this topic. Regards, Pete
9. Re: Standard toolkit
- Posted by Jason Gade <jaygade at gmail.com> Jul 03, 2005
- 677 views
Pete Lomax wrote: > > > On Fri, 01 Jul 2005 18:22:31 -0700, Jason Gade <jaygade at gmail.com> > wrote: >>Arwen is Windows-specific, isn't it? <snip> >>Just wondering because if a set of libraries is recommended as a >>standard "user toolkit" it should be cross-platform. That's why I was > > Just because something is not xplat should not be a reason for > refusing to recommending it. As a bad example, perhaps, I use dir > (or Explorer) on Windows and ls (or Konqueror) on Linux. Depends.exe > is strictly windows-only, since it examines .dll files, but should > still feature somewhere on any recommended utility list. Sure, put > these things lower down the list, but don't exclude them. Okay. I was actually trying to avoid the gui library portion at this point anyway and I wanted to concentrate on utility portions. There are a lot of gui libraries available right now, both cross-platform and platform specific. I think cklester's site covers the situation pretty good. > > >>thinking that wxEuphoria would be a good recommendation for >>gui/networking toolkit. I know that Win32Lib is much more mature but it >>is Windows-specific (for now). I still think that it is probably a good >>example of how a library *should* be written but I could be wrong since >>I haven't examined it extensively either. > > Win32lib is indeed stable and feature rich. However I don't think > anyone would actually say it should be used as an *example* of how a > library *should* be written. That is not the same as saying there is > no high-quality code in there, but *starting* a new library, I can't > imagine a worse way than attempting to copy win32lib. > (I may be talking at cross purposes here; the exposed API of win32lib > is in general exceptional.) > > One of the things about well-written code is that it is highly > subjective. In fact, the sole purpose of attempting to craft > well-written code is that more people can readily understand it. > I will be interested in reviewing whatever you finally declare is > well-written. Well, that's the problem. I'm not very good at reading source code. Actually, I can usually understand small pieces of the puzzle but then trying to take a step back and understanding the complete structure is difficult. That's probably why I've never moved beyond beginning programmer despite years of study. But my current goal is to look at the OpenEU spec and kind of see what can be written into a library instead of directly into the language, what kinds of other utility routines are needed and/or regularly used by the community, and what features other languages have either in their libraries or core language that could be used in a Euphoria library. I'm not even saying that I'll come up with something, I'm just surveying the scene such as it is. I'm thinking of trying my hand at another project but I've never written gui code, database code, or networking code and the project would require all of that. It looks like aku saya has come up with a library project that I want to check out as well. > >>As per Christian Cuvier's suggestion I am kind of surveying what kind of >>library routines are currently used by programmers in Euphoria. I think >>that is a good start towards a user toolkit/recommended set of add-on >>routines that everyone should have available. > > > CK has a section on his web page devoted to this topic. > > Regards, > Pete > -- ============================== Too many freaks, not enough circuses. j.
10. Re: Standard toolkit
- Posted by Jason Gade <jaygade at gmail.com> Jul 03, 2005
- 674 views
aku saya wrote: > > > J> Can anyone tell me what (non-RDS) library files besides > J> Win32Lib that they use regularly in their projects? I'm mostly > J> asking about utility functions, not graphics libraries and such. > J> Stuff like print.e, sprint.e, tk_*.e, etc. Include your own > J> libraries that you may not have released to the archive. > > J> Some other questions: > > J> * If this library is in the archive and you're a registered > J> user, have you voted microbucks for it? > > J> * If this library is not in the archive, why not? > > Having used Eu for 5 years, nearly all projects I made always include > a file I made as standard library. > > So I think Eu standard library is very important. > > So I translated the include file to English and removed a lot of > routines that I think would not be too useful for the others. > > The file is below. Some of the routines are obtained from Euforum, but > sorry I didn't keep the original author names. > > A lot of routines are still missing. I think these routines need to be > included in the standard library project: > - copy/rename/move/delete/rmdir functions, USING WIN32 API and LINUX > SYSTEM CALLS instead of system("del " & filename,0) which I hate very > much (personally) since it's not reliable > - *simple* hash map/set, like hash_set(key, value), > hash_get(key, default_value), hash_find(key), etc > - date/time library, like datetime.e by CyrekSoft Derek Parnell and Jiri Babor both have hash libraries in the archive. > Looking forward for your suggestions, etc! -- ============================== Too many freaks, not enough circuses. j.
11. Re: Standard toolkit
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 03, 2005
- 696 views
- Last edited Jul 04, 2005
On Sun, 03 Jul 2005 08:41:21 -0700, Jason Gade <jaygade at gmail.com> wrote: >But my current goal is to look at the OpenEU spec and kind of see what >can be written into a library instead of directly into the language, >what kinds of other utility routines are needed and/or regularly used by >the community, and what features other languages have either in their >libraries or core language that could be used in a Euphoria library. > >I'm not even saying that I'll come up with something, I'm just surveying >the scene such as it is. I'm thinking of trying my hand at another >project but I've never written gui code, database code, or networking >code and the project would require all of that. That is a very good mission statement. > >It looks like aku saya has come up with a library project that I want to >check out as well. Yes, that is a very good starting point (thanks aku). I have a local copy and I plan to post some of my recommendations (as asked for) in a few days. Regards, Pete
12. Re: Standard toolkit
- Posted by Al Getz <Xaxo at aol.com> Jul 04, 2005
- 682 views
Jason Gade wrote: > > Al Getz wrote: > > > > > > posted by: Al Getz <Xaxo at aol.com> > > > > Jason Gade wrote: > > > >>Can anyone tell me what (non-RDS) library files besides Win32Lib that they > >>use regularly > >>in their projects? I'm mostly asking about utility functions, not graphics > >>libraries > >>and such. Stuff like print.e, sprint.e, tk_*.e, etc. Include your own > >>libraries that > >>you may not have released to the archive. > >> > >>Some other questions: > >> > >>* If this library is in the archive and you're a registered user, have you > >>voted microbucks > >>for it? > >> > >>* If this library is not in the archive, why not? > >> > >>===================================== > >>Too many freaks, not enough circuses. > >> > >>j. > >> > > > > Hi there Jason, > > > > > > There's also the "WinClass" C++ style library, which is easier to > > modify than some of the big single file libraries. It's also > > organized better in a class hierarchical order, does COM/Ole > > (has interfaces already too), and already has many custom classes. > > The COM structure is the simplest found anywhere on the web i believe. > > > > The version right now in the archive is the older version. > > The new version, complete with almost every Windows class there is, > > is due out around the middle of next week. The new classes round out > > the library quite nicely: > > > > Treeview, Listview, Scrollbars, Trackbars, Rebar, Updown, TabControl, > > PropertySheet, Toolbars, Calendar, AppointmentBook, Progressbars, > > Marquee, as well as "Long Operation" support which is multi thread-like. > > > > Unlike Microsoft's standard Marquee Control, the WinClass Marquee Control > > works on all systems Win95,98, etc., not just XP, and of course can > > be geared with it's own thread-like operation. > > > > The PropertySheet Control is easy to use too...almost like creating > > a window with child windows. > > > > > > Take care, > > Al > > > > And, good luck with your Euphoria programming! > > > > My bumper sticker: "I brake for LED's" > > I've browsed the Winclass library and I like what I see. I do wish that > Euphoria was more modular -- one of those things that would make OO > programming easier. I don't drink the OO koolaid, but I think that it > can be a useful technique. > > It would be cool if it was cross-platform, though. > > One enhancement for the language itself that can't be done in a library > is better handling of includes/imported files and namespaces. I know > that has been hashed out ad infinitum ad nauseum on this list. > > But yet another proposal would be this: > include filename works as-is, that is include the file one time only, > but if I "include graphics.e" and "include lib/graphics.e" the > interpreter should recognize it as different files. > > But if you "include graphics.e as circle" and then "include graphics.e > as square" it would include graphics.e in each different namespace thus > simulating objects. Maybe adding an import keyword would work better > here, and programmers would have to be careful with top-level statements > and nesting includes. > > Euphoria's method of scoping is there for OO type programming but the > namespace and include mechanism isn't. > > But I don't see any changes there any time soon. > > Anyway, I do like the technique used in the Winclass library and I look > forward to checking out the next version. > > -- > ============================== > Too many freaks, not enough circuses. > j. > > Hi there Jason, I guess i could go cross platform with it at some point. Yes i'd like to see Euphoria includes that can be re-included as another name and have a whole new object to work with. Im hoping to have the WinClass Library ready to go this week. I realized that i didnt have a demo of the Property Sheet that i could go public with so im throwing one together now. My Scientific Calculator uses that class but i dont really want to release that to the general public, and besides it has way too much more in it to be a good demo. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
13. Re: Standard toolkit
- Posted by Michael Raley <thinkways at yahoo.com> Jul 05, 2005
- 675 views
left and right space padding for strings. This will truncate it if the string length exceeds n, which may not always be desirable... ;
---------------------------------------------<bonus functions> global function Lpad(object s, integer n) --left padded text integer l , comp if atom(s) then s = {s} end if l = length(s) if l<n then comp = n -l s &= repeat(' ',comp) elsif l>n then s = s[1..n] end if return s end function ----------------------------------------------- global function Rpad(object s, integer n) --right padded text integer l , comp l = length(s) if atom(s) then s = {s} end if if l<n then comp = n -l return repeat(' ',comp) & s elsif l>n then s = s[1..n] end if return s end function
--"ask about our layaway plan". --
14. Re: Standard toolkit
- Posted by "Christian Cuvier" <christian.cuvier at agriculture.gouv.fr> Jul 06, 2005
- 661 views
In my previous answer about libs I use, I was referring to mseval.e . Its author is M. Stachon. I didn't release my custom version as a separate file as it was very much specialised (used in DieRoll, if you're interested). CChris
15. Re: Standard toolkit
- Posted by "Kat" <gertie at visionsix.com> Jul 06, 2005
- 665 views
Re: strings There's nice basic (no pun intended) functions in string.e by Greg Harris For "associated strings", there's several, i began using Jiri Babor's a while back. It makes up for the lack of dynamic string generation which mirc and many Basics have. It can also be slightly modified to make it run code on certain vars when you access them. For regex, David Cuny wrote one years ago, and Bach has regex.b. Kat
16. Re: Standard toolkit
- Posted by Jason Gade <jaygade at yahoo.com> Jul 06, 2005
- 683 views
Kat wrote: > > Re: strings > > There's nice basic (no pun intended) functions in string.e by Greg Harris > > For "associated strings", there's several, i began using Jiri Babor's a while > back. It makes up for the lack of dynamic string generation which mirc and > many Basics have. It can also be slightly modified to make it run code on > certain vars when you access them. > > For regex, David Cuny wrote one years ago, and Bach has regex.b. > > Kat > > Pardon my ignorance, but what is "dynamic string generation"? ===================================== Too many freaks, not enough circuses. j.
17. Re: Standard toolkit
- Posted by "Kat" <gertie at visionsix.com> Jul 06, 2005
- 687 views
On 6 Jul 2005, at 8:14, Jason Gade wrote: > > > posted by: Jason Gade <jaygade at yahoo.com> > > Kat wrote: > > > > Re: strings > > > > There's nice basic (no pun intended) functions in string.e by Greg Harris > > > > For "associated strings", there's several, i began using Jiri Babor's a > > while > > back. It makes up for the lack of dynamic string generation which mirc and > > many Basics have. It can also be slightly modified to make it run code on > > certain vars when you access them. > > > > For regex, David Cuny wrote one years ago, and Bach has regex.b. > > > > Kat > > > > > Pardon my ignorance, but what is "dynamic string generation"? At a basic level, in some languages, you don't need to pre-declare all the variables you wish to use. You don't even need to state the form the name of the var takes or the data it holds, which makes languages like mirc very adept at finding things (altho mirc is so much slower than Eu it's not even on the same planet). Instead of: sequence thisvar, thatvar you simple begin using the var's name: anothervar = "blah" or, like i am fond of doing in mirc: if ( %npass.oper. [ $+ [ %net ] $+ . $+ [ %server ] $+ . $+ [ $me ] ] != $null ) { ; code here } or: if ( %iop. [ $+ [ %net ] $+ . $+ [ # ] ] == yes ) { idme } and in that code i don't need to spec what network i am on, the server's name, or my nick there, or that the var even exists or what form (sequence, integer, etc) the var has. If the var doesn't exist, there's no error. And i used all those "& . &" to make a dotted notation to the variable's name, so i can do this sorta thing: set -u0 %temp.nick&pass $read -w [ $+ [ *=%npass.oper. [ $+ [ %net ] $+ . $+ [ %server ] $+ ] .* ] ] $mircdir/remotes/ctcp.ini which is mirc's way of setting a local var, doing a file read with pattern matching of a var i make the name of on-the-fly. Makes it so easy to do this too: -- in the on:join event idme set %did.id. [ $+ [ %net ] $+ . $+ [ # ] $+ . $+ [ $me ] ] did which makes a var like: %did.id.dalnet.#test.kat did -- in the on:part event unset %did.id. [ $+ [ %net ] $+ . $+ [ # ] $+ .* ] which unsets all the ident'ing i did in that channel for any nick i used while there. --in the on:quit, on:disconnect, on:start events -- or in one alias called by them unset %did.id.* and all the vars signifying that i did id for any network, room, nick, and channel are cleared in one decidedly non-Euphoric swoop. Can't do those things natively in Euphoria. Which is also why strtok got written, because i can do this in mirc: if ( *!* at user-?*?*.dialup.mindspring.com iswm %1 ) { if ( $2 == 3 ) { return *!* $+ $right($remove($gettok($gettok(%1,1,64),2,42),~),9) $+ @user-* $+ $gettok($gettok($gettok(%1,1,46),2,64),2,63) $+ *.dialup.mindspring.com } } But associated lists help a *lot*, because you can do -- pseudocode! proc setvar(object whatvar,object data) -- see jiri's/derek's code for how to do this end proc func getvar(object whatvar) -- see derek's/jiri's code on how... return data else return 0 end func setvar({"blarg."&chan&".bloo"},textline) if match(getvar("what."&chan&".bloo"),data[1]) then -- falls thru, no errors, if var doesn't exist -- normal eu code end if Now if i could get a: goto "what."&chan&".bloo" or goto gettok(data[1],32) or goto %var like mirc has!! Kat wishing terribly that Euphoria was more advanced
18. Re: Standard toolkit
- Posted by Jason Gade <jaygade at yahoo.com> Jul 06, 2005
- 669 views
Kat wrote: > > Re: strings > > There's nice basic (no pun intended) functions in string.e by Greg Harris > > For "associated strings", there's several, i began using Jiri Babor's a while > back. It makes up for the lack of dynamic string generation which mirc and > many Basics have. It can also be slightly modified to make it run code on > certain vars when you access them. > > For regex, David Cuny wrote one years ago, and Bach has regex.b. > > Kat > > I couldn't find string.e by Greg Harris in the archive unless it is under something else. Doing a search for Greg Harris just comes up with two results -- Faster Palette Routines and Animation Test. ===================================== Too many freaks, not enough circuses. j.
19. Re: Standard toolkit
- Posted by Jason Gade <jaygade at yahoo.com> Jul 06, 2005
- 706 views
Jason Gade wrote: > > Kat wrote: > > > > Re: strings > > > > There's nice basic (no pun intended) functions in string.e by Greg Harris > > > > For "associated strings", there's several, i began using Jiri Babor's a > > while > > back. It makes up for the lack of dynamic string generation which mirc and > > many Basics have. It can also be slightly modified to make it run code on > > certain vars when you access them. > > > > For regex, David Cuny wrote one years ago, and Bach has regex.b. > > > > Kat > > > > > I couldn't find string.e by Greg Harris in the archive unless it is under > something > else. Doing a search for Greg Harris just comes up with two results -- Faster > Palette > Routines and Animation Test. But if you meant the one by Normand Blais, then never mind. I found it. ===================================== Too many freaks, not enough circuses. j.
20. Re: Standard toolkit
- Posted by "Kat" <gertie at visionsix.com> Jul 07, 2005
- 681 views
On 6 Jul 2005, at 10:43, Jason Gade wrote: > > > posted by: Jason Gade <jaygade at yahoo.com> > > Jason Gade wrote: > > > > Kat wrote: > > > > > > Re: strings > > > > > > There's nice basic (no pun intended) functions in string.e by Greg Harris > > > > > > For "associated strings", there's several, i began using Jiri Babor's a > > > while back. It makes up for the lack of dynamic string generation which > > > mirc > > > and many Basics have. It can also be slightly modified to make it run code > > > on certain vars when you access them. > > > > > > For regex, David Cuny wrote one years ago, and Bach has regex.b. > > > > > > Kat > > > > > > > > I couldn't find string.e by Greg Harris in the archive unless it is under > > something else. Doing a search for Greg Harris just comes up with two > > results > > -- Faster Palette Routines and Animation Test. > > But if you meant the one by Normand Blais, then never mind. I found it. -- file: string.e -- author: Normand M. Blais -- date: January 4 1999 -- -- Modified 12/8/99 -- Greg Harris Sorry! Kat
21. Re: Standard toolkit
- Posted by "Kat" <gertie at visionsix.com> Jul 07, 2005
- 694 views
Someone mentioned replace() earlier, here is the one i use, it's case- insensitive, with a wildcard matching:
function replace(sequence st,sequence old_ch,sequence new_ch) integer k, k1, k2 sequence newst, old_ch1, old_ch2 if match("*",old_ch) then old_ch1 = old_ch[1..match("*",old_ch)-1] old_ch2 = old_ch[match("*",old_ch)+1..length(old_ch)] k1 = match(upper(old_ch1),upper(st)) k2 = match(upper(old_ch2),upper(st)) newst = "" while (k1 and k2) and (k2 > k1) do newst = newst & st[1..k1-1] & new_ch st = st[k1..length(st)] st = st[k2 + length(old_ch2)..length(st)] k1 = match(upper(old_ch1),upper(st)) k2 = match(upper(old_ch2),upper(st)) end while newst = newst & st return newst else k = match(upper(old_ch),upper(st)) newst = "" while k do newst = newst & st[1..k-1] & new_ch st = st[k+length(old_ch)..length(st)] k = match(upper(old_ch),upper(st)) end while newst = newst & st return newst end if end function
works like: TheWebPage = replace(TheWebPage,")","\"") TheWebPage = replace(TheWebPage,"<font*>","") It can be sped up some, i'm sure. My 2nd version of replace is a bit ratty, but has a case switch, a do_not_replace switch, and a do_replace_only switch. Maybe i'll post it when cleaned up. Kat
22. Re: Standard toolkit
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 07, 2005
- 705 views
Pete Lomax wrote: > On Sun, 03 Jul 2005 08:41:21 -0700, Jason Gade wrote: <snip> >> It looks like aku saya has come up with a library project that I want to >> check out as well. > Yes, that is a very good starting point (thanks aku). I have a local > copy and I plan to post some of my recommendations (as asked for) in a > few days. I disagree. At the same time, while people talk about reviving the Standard Library Project, instead of joining the discussion and working together with these people, Aku just post his own code, and even also calls it "Standard Library". That's strange (to say the least). Also, I -- as well as probably several other people here -- have some similar code on my harddisk, too. So we all should post it now and call it "Standard Library", or what? Regards, Juergen