1. edx.ex including Context Sensitive Help posted RDS Recent Contributions

Many of my mods may provoke laughter, but I think the syncolor and context sensitive help support for 1400 Standard Library Keywords may be of interest to some.

Edx.ex specific include files have the extension *.edx, so you can install the files in the same directory as ed.ex without "stepping on" any files.

I have just uploaded the file to RDS User Contributions, so it should be available soon.

Kenneth Rhodes

new topic     » topic index » view message » categorize

2. Re: edx.ex including Context Sensitive Help posted RDS Recent Contributions

The file, include euphoria/prompt.edx, is missing from the package uploaded to The Archive.

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

3. Re: edx.ex including Context Sensitive Help posted RDS Recent Contributions

_tom said...

The file, include euphoria/prompt.edx, is missing from the package uploaded to The Archive.

Thanks, I'll upgrade the package. In the meantime here is the missing file:

-- 
-- 
------------------------------- prompt.e  ------------------------------- 
--             (modifications to Euphoria 2.1 prompt functions) 
--                              revised 01/22/99 
-- 
-- 
--  prompt_n(), a modification of prompt_number() 
--  syntax:     include get. 
--              include prompt.e 
--              a = prompt_number(pos,st,s) 
-- 
-- Description: Prompt the user to enter a number.  pos is a sequence of 2 
-- values {line, column} representing the screen coordinates 
-- i.e. position(line, column) ) where the prompttext  (sequence st) 
-- will be displayed.  The third parameter "s" is a sequence of 
-- two values {lower, upper} which determine the range of values 
-- that the user may enter.  If the user enters a number that is 
-- less than the lower or greater than the upper, or if the 
-- the user enters a letter instead of a number, the invalid 
-- input string will be erased and the cursor reset at the input 
-- position. No error message will be issued. 
-- 
-- example:  age = prompt_n({4,1},"What is your age? ",{0,150}) 
-- the input prompt, "What is your age?  " is printed at position(4,1) 
-- 
-- 
include get.e 
 
public function prompt_n(sequence pos, sequence prompt, sequence range) 
    -- Prompt the user to enter a number. 
    -- A range of allowed values may be specified. 
    object answer 
    sequence buffer                     -- holds length of input 
     
    while 1 do 
	 
	position(pos[1],pos[2]) 
	puts(1, prompt) 
	buffer = gets(0)                -- make sure whole line is read 
	answer = value(buffer) 
	 
	if answer[1] != GET_SUCCESS or sequence(answer[2]) then 
	     
	    position(pos[1],pos[2]) 
	    for x = 1 to length(buffer) + length(prompt) do 
		puts(1, " ") 
	    end for 
	     
	else 
	    if length(range) = 2 then 
		if range[1] <= answer[2] and answer[2] <= range[2] then 
		    return answer[2] 
		else 
		    for x = 1 to length(buffer) + length(prompt) do 
			puts(1, " ") 
		    end for 
		end if 
	    else 
		return answer[2] 
	    end if 
	end if 
    end while 
end function 
 
-- 
-- 
--  prompt_s()   - a modification of prompt_string() 
--  syntax:     include get.e 
--              include prompt.e 
--              a =prompt_s(pos,st) 
--  first parameter is a 2 element seqence for line and column coordinates 
--  2nd parameter is the prompt string 
--  example: answer = prompt_s({4,2}, "Is today your birthday?    ") 
--       (prompt text is printed at the 4th line, 2nd column) 
-- 
-- 
public function prompt_s(sequence pos, sequence prompt) 
    -- Prompt the user to enter a string 
     
    object answer 
    position(pos[1], pos[2]) 
    puts(1,prompt) 
    answer = gets(0) 
    if sequence(answer) and length(answer)>0 then 
	return answer[1..length(answer)-1] -- trim the \n 
    else 
	return "" 
    end if 
end function 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu