Software Inquiry

Discussion forum for JP1 software tools currently in use, or being developed, such as IR, KM, RemoteMaster, and other misc apps/tools.

Moderator: Moderators

The Robman
Site Owner
Posts: 21984
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

How versatile is IRP in documenting protocols that basically have IF statements in them? In other words, if a protocol sends one type of signal for OBCs in the range 0-127 and another for OBCs in the range 128-255, does IRP support that?

Obviously, many of our executors do that sort of thing, but many of them are "combo" executors which means that, if you were to learn the signals, they would report different protocols and/or device codes.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Barf
Expert
Posts: 1525
Joined: Fri Oct 24, 2008 1:54 pm
Location: Munich, Germany
Contact:

Post by Barf »

You are right. Probably some extension of IRP is needed for this. But this can be done. For example, I wrote this back in 2011.

A possible syntax might be something like this, for a three protocol combo, basically using the syntax of the ternary ?: operator as in C and derived languages, like Java:

Code: Select all

mode == 0 ? ( /* IRP of first version */ )  \
: mode == 1 ?  (/* IRP of second version */  \
: (/* IRP of third version */)
mathdon
Expert
Posts: 4730
Joined: Tue Jul 22, 2008 8:53 am
Location: Cambridge, UK

Post by mathdon »

As I have mentioned elsewhere, I have developed a program that converts MAXQ executor code into IRP notation. This brought to light two requirements that standard IRP notation does not handle. One is the If .. Then .. Else construction that Rob has raised, the other is the use of arrays, where one or two bits of a variable byte form an index into the array formed by the fixed bytes. I handled these in an informal way that is intended to be reasonably self-explanatory to a human reader. Here, as a simple example, is the output for the Sony Combo protocol:

Code: Select all

Sony Combo (12/15/20): PID=0027.new

4 fixed bytes: bit-reversed A B C D
2 variable bytes: bit-reversed X Y

If X:1:7=0

Preamble:
N1=A[Y:-2:5]

{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:5,^45000u)3+  // when Y=0xxxxxxx

{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:5,N1:8,^45000u)3+  // when Y=1xxxxxxx

If X:1:7=1

{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:8,^45000u)3+
The preamble is a pre-processor that in the general case may itself contain conditional statements. This gives three levels of conditionals, an outer one before any required preamble, conditionals within any preambles, and finally an inner one after the preamble. There may be executors that even this structure does not cover, as my program handles most, but not all, known MAXQ executors.

I would be interested in seeing an extension of IRP notation that could cover these requirements in a way that is machine-processable while retaining reasonable readability for human readers. Over to you, Barf?
Graham
Barf
Expert
Posts: 1525
Joined: Fri Oct 24, 2008 1:54 pm
Location: Munich, Germany
Contact:

Post by Barf »

I am not quite sure what your array notation means, but, with a few guesses, some not introduced notation, and a few assumptions swept under the table, how about this (line breaks introduced for readability):

Code: Select all

{40.0k,600}<1,-1|2,-1>(                                         
                       X:1:7 ?          (4,-1,X:7,Y:8,^45000u)    
                             : (y:1:7 ? (4,-1,X:7,Y:5,N1:8,^45000u) 
                                      : (4,-1,X:7,Y:5,^45000u)      
                               )                                   
		                         )3+                                       
{A=fixed:-8:24, B=fixed:-8:16, C=fixed:-8:8, D=fixed:-8,            
X=variable:-8:8, Y=variable:-8,                                     
N1 =  Y:-2:5==0 ? A                                                 
    : Y:-2:5==1 ? B                                                 
    : Y:-2:5==2 ? C                                                 
    : Y:-2:5==3 ? D }
Basically, it is a matter of allowing the conditional operator af a few places.
Post Reply