X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=funcs.c;h=8ac14c685c0d129e797959084f007ad2ee7a3d14;hb=a2ded27fbbe1d152bcc1927e6decff86e2c940a7;hp=7444e66b7a713889e90102d7ba3b074b2228a9bf;hpb=36403b46c9eec27a672b0cfbfad9a79c7d153dca;p=pd_readline diff --git a/funcs.c b/funcs.c index 7444e66..8ac14c6 100644 --- a/funcs.c +++ b/funcs.c @@ -11,11 +11,16 @@ #include #include #include +#include "pd_readline.h" +/* Note - make the up and down funcs return a buffer. */ +/* A line from the history file can be put into the */ +/* array member of the buffer. */ +/* Also test for the top and bottom of the history file. */ /* Move up in history list. */ -int up(int i) +buf up(int i) { @@ -24,7 +29,7 @@ int up(int i) /* Move down in history list. */ -int down(int i) +buf down(int i) { @@ -63,17 +68,52 @@ buf insch(buf b) } - -/* Function to handle escape sequences. */ -int esc(int i) +void enter(void) { + printf("Enter "); +} + + +/* Find if a number is in a given range. */ +int range(int rstart, int rend, int i) +{ + if ( (rstart <= i) && (i <= rend) ) return 1; + else return 0; - - - -} +} + +/* Assign a type depending on the range that a */ +/* number is in. */ +int type(int i) +{ + int ret; + + if ( range(0, 9, i) == 1 ) ret = 1; + else if ( range(10, 10, i) == 1 ) ret = 2; + else if ( range(27, 27, i) == 1 ) ret = 3; + else if ( range(32, 126, i) == 1 ) ret = 4; + else if ( range(127, 127, i) == 1 ) ret = 5; + else ret = 6; + + return ret; + +} + +/* Function for special key combinations */ +/* (Ctrl, Alt, function keys. */ +void spec(void) +{ + + int j = getch(); + + if ( ( j == 65 ) ) printf("Up "); + else if ( ( j == 66 ) ) printf("Down "); + else if ( ( j == 67 ) ) printf("Right "); + else if ( ( j == 68 ) ) printf("Left "); + +}