static TACommandVerdict ripoffline_cmd(TAThread thread,TAInputStream stream) { int line; int init; int res; line = readInt(&stream); init = readInt(&stream); START_TARGET_OPERATION(thread); if(init) { res = ripoffline(line, init_func); } else { res = ripoffline(line, NULL); } END_TARGET_OPERATION(thread); writeInt(thread, res); sendResponse(thread); return taDefaultVerdict; }
/* ARGSUSED */ int __m_slk_init(SCREEN *sp, int style) { int code; code = ERR; (void) memset(&sp->_slk, 0, sizeof (sp->_slk)); /* Does the terminal have a method to program the soft label key? */ if (plab_norm != NULL || pkey_plab != NULL) { code = OK; goto done; } /* We have to fake it. */ if (lines < 2) goto done; sp->_slk._w = subwin(sp->_newscr, 1, 0, lines-1, 0); if (sp->_slk._w == NULL) goto done; /* Test suite seems to expect this */ (void) wattrset(sp->_slk._w, A_DIM|A_REVERSE); (void) ripoffline(-1, 0); code = OK; done: return (code); }
int slk_init(int format) { if (format < 0 || format > 1) return ERR; _slk_format = format; ripoffline(-1, slk_initialize); return OK; }
/*** Reduce the available size of the main screen. @function ripoffline @bool top_line @func callback @treturn bool `true`, if successful @see ripoffline(3x) */ static int Pripoffline(lua_State *L) { static int rip = 0; int top_line = lua_toboolean(L, 1); #if LCURSES_POSIX_COMPLIANT if (!lua_isfunction(L, 2)) { lua_pushliteral(L, "invalid callback passed as second parameter"); lua_error(L); } /* need to save the lua state somewhere... */ rip_L = L; /* get the table where we are going to save the callbacks */ lua_pushstring(L, RIPOFF_TABLE); lua_gettable(L, LUA_REGISTRYINDEX); if (lua_isnil(L, -1)) { lua_pop(L, 1); lua_newtable(L); lua_pushstring(L, RIPOFF_TABLE); lua_pushvalue(L, -2); lua_settable(L, LUA_REGISTRYINDEX); } /* save function callback in registry table */ lua_pushvalue(L, 2); lua_rawseti(L, -2, ++rip); /* and tell curses we are going to take the line */ return pushokresult(ripoffline(top_line ? 1 : -1, ripoffline_cb)); #else return binding_notimplemented(L, "ripoffline", "curses"); #endif }