Hi guys,

I'm currently migrating my own SirBot project to jallib, and added 
some "pragma inline" statements in my lib, to save some stack (and eventually 
fix a stack overflow 11 of 8 in one of my program :)).

The problem is with "pragma inline", it just does not work. I use jalv24i, 
("jal 2.4i (compiled Dec  1 2008)").

I thought "pragma inline" were fixed, and before I report some potential 
problem to jallist, I'd like your input on this.

Attached is a compilable example, against jallib. If you try, you'll an 
infinite loop while calling send_message (keep sending "\x01m"). It never 
reach the forever loop. Commenting out "pragma inline" makes the whole work.


Thanks for your help. I hope it's just something  I do wrong, and not a bug ;)
Seb
-- 
Sébastien LELONG
http://www.sirloon.net
http://sirbot.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

include 16f88
pragma target CLOCK		8_000_000		-- You can also say: 4_000_000, 8_000_000
pragma target OSC		INTOSC_NOCLKOUT	-- HS: high-speed crystal (4 .. 20 MHz)
pragma target WDT		disabled
-- disable analog I/O (if any)
enable_digital_io()

const usart_hw_serial		= true		-- true = RS232, false = SPI
const serial_hw_baudrate	= 19_200	-- 1_250_000 (if supported), 57_600, 19_200, 9600, ...
include serial_hardware
serial_hw_init()

-- set all interrupt sources disabled
INTCON = 0      -- /!\ 0 = disabled all interrupt sources


const ALLOW_ECHO = true
const SOF_CHAR = 1
const EOF_CHAR = 4
const ALLOW_LENGTH = true
const MSG_TYPE = "m"
const RES_TYPE = "r"
const PING_CHAR = "?"	-- If I got a ping char, I should...
const byte PONG_CHAR [] = "!"   -- ... send a pong char
const byte RESET_CHAR [] = "*"
const OPEN_BRACKET_CHAR = "("
const CLOSE_BRACKET_CHAR = ")"
const COMMA_CHAR = ","



procedure send(byte in data [], byte in type) is
	-- SOF
	if SOF_CHAR != 0
	then
		serial_hw_write(SOF_CHAR)
	end if
	-- length
	if ALLOW_LENGTH == true
	then
		-- +1 : include type char
		var byte length = byte(1 + count(data))
		serial_hw_write(length)
	end if
	-- type
	serial_hw_write(type)
	-- data
	var byte i
	var byte char
	for count(data) using i loop
		-- BUG in jalv2 2.3: must put a var, not a const
		-- when using flexible array (this is the case
		-- if RESET_CHAR or PONG_CHAR is sent)
		char = data[i]
		serial_hw_write(char)
	end loop
	-- EOF
	if EOF_CHAR != 0
	then
		serial_hw_write(EOF_CHAR)
	end if
end procedure

procedure send_message(byte in data []) is
	pragma inline
	send(data,MSG_TYPE)
end procedure


send_message(RESET_CHAR)

-- repl impl.
var byte char
forever loop
	if serial_hw_read(char) then
		serial_hw_write(char)
		;;echo(char)
		;;default_eval(char)	-- back to mandatory commands
	end if
end loop



Reply via email to