1. Simple tools

Hi,

There are a lot of great programmers on this list and, though I consider
myself somewhere in the Euphoria beginner class, I read the comments of
the advanced group with pleasure.

Still, I would like to see more comments from beginner/intermediate
people.  Sometimes I get a bit lost in the details of higher-level
programming and I guess that must be true for others also.

My own area of interest over the years of hobby programming has been
writing utilities, text-oriented programs, and some playing with demos
of ideas, such as AI, rather than graphics and games.

-----

I recently sent in a program that Rob posted called LISTRTNS.  I have
working to improve it and have made some headway.  The currently posted
version fails to read all the declaration of a function if it is on more
than one line.  I have corrected that.  I will send Rob the improved
version soon.  Here is an example of its extraction of function headings
from a few files in C:\EUPHORIA\INCLUDE.  The program will optionally
list the function declarations lines of a file to the top of the file.

--* Begin List of Functions & Procedures *
---> File: C:\EUPHORIA\INCLUDE\DLL.E
--global function open_dll(sequence file_name)
--global function define_c_proc(atom lib, sequence routine_name,
--         sequence arg_sizes)
--global function define_c_func(atom lib, sequence routine_name,
--         sequence arg_sizes, object return_type)
--global function call_back(integer id)
--global procedure free_console()
--* End List of Functions & Procedures   *

--* Begin List of Functions & Procedures *
---> File: C:\EUPHORIA\INCLUDE\FILE.E
--global function seek(file_number fn, file_position pos)
--global function where(file_number fn)
--global function dir(sequence name)
--global function current_dir()
--global procedure allow_break(boolean b)
--global function check_break()
--function default_dir(sequence path)
--global function walk_dir(sequence path_name, integer your_function,
--    integer scan_subdirs)
--* End List of Functions & Procedures   *

--* Begin List of Functions & Procedures *
---> File: C:\EUPHORIA\INCLUDE\GET.E
--global function wait_key()
--procedure get_ch()
--procedure skip_blanks()
--function escape_char(char c)
--function get_qchar()
--function get_string()
--function get_number()
--function Get()
--global function get(integer file)
--global function value(sequence string)
--global function prompt_number(sequence prompt, sequence range)
--global function prompt_string(sequence prompt)
--global function get_bytes(integer fn, integer n)
--* End List of Functions & Procedures   *

Is this useful?  It is for me.  I use PowerDesk to inspect include files
and text output as I work.  Having the functions listed to the top of
the file speeds up my work.  One of the ongoing problems I have with
programming might be called "house-keeping" difficulties.  The
proliferation of include files is bewildering to me (and probably to
others).  When I created a single list of all the function declarations
under my C:\EUPHORIA, I got a 500+ KB file!

I assume programmers with good academic training have consciously
applied skills to maintain coherence amid so many things to remember and
organize.  Any advice from the well-organized would be welcome.  As time
goes on, I will offer some commentary on these more "philosophical"
aspects of programming and am here asking for any such comments from
others regarding programming shortcuts and ways to organize projects.

To beginners, I offer a thought and an example:  Why not reduce the
number of functions you have to pay attention to by enlarging  or
overloading  it?  The function Strip below allows a LeftStrip,
RightStrip and BothStrip in one function, thus eliminating two
functions.  By including a "mode" number with it, it is a 3-in-1
function.  I may eventually get rid of the delimeters argument as
unnecessary, but it may be useful someday.  In practice, I call the
Strip function with a constant called DELIMETERS.  Another point: I have
included my handle -- Quark -- in the comment line within the function.
If this were universal practice, then shared-around functions would
automatically contain a credit to the author.  I would be pleased to
have a bunch of hard-working programmers credited in programs I write!
The more the merrier.

------------------------------
global function Strip(sequence s,sequence delimeters,integer mode)
--Quark: Strip whitespace from s in mode way (0=left,1=right,2=both)
if equal(mode,0) or equal(mode,2)then
   while length(s) and find(s[1],delimeters) do
      if equal(length(s),1) then
  s={}
      else
  s=s[2..length(s)]
      end if
   end while
end if
if equal(mode,1) or equal(mode,2) then
   while length(s) and find(s[length(s)],delimeters) do
      if equal(length(s),1) then
  s={}
      else
  s=s[1..length(s)-1]
      end if
   end while
end if
return s
end function
------------------------------

That's it.  Thanks to all.

--Quark

new topic     » topic index » view message » categorize

2. Re: Simple tools

If you download Carl White's editor from the archive.
  It's called ee21cs3.zip. If you are editing a file and wanting
  to know what functions and procedures are in it, you just have to
  hit F2 and a drop-down  list of the procedures and functions in the file
  will appear. You can switch to any other file that is loaded in the
  editor and do this. Doing an enter on the high-lighted function will
  position you to that function in the file. Also the clipboard can be
  transfered back and forth between dos and windows.

  These are the kind of tools that I find very useful in programming.

  Some of the tools I would like to see in Euphoria are:

  A folding editor in DOS
  A easier way to interface with machine code in DOS

Bernie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu