type
stringclasses
5 values
content
stringlengths
9
163k
functions
void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape ) { Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor, noColorEscape ); }
functions
void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape ) { Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor, noColorEscape ); }
functions
void Field_Paste( field_t *edit ) { char *cbd; int pasteLen, i; cbd = Sys_GetClipboardData(); if ( !cbd ) { return; }
functions
void Field_KeyDownEvent( field_t *edit, int key ) { int len; // shift-insert is paste if ( ( ( key == K_INS ) || ( key == K_KP_INS ) ) && keys[K_SHIFT].down ) { Field_Paste( edit ); return; }
functions
visible if ( edit->cursor < edit->scroll ) { edit->scroll = edit->cursor; }
functions
else if ( edit->cursor >= edit->scroll + edit->widthInChars && edit->cursor <= len ) { edit->scroll = edit->cursor - edit->widthInChars + 1; }
functions
void Field_CharEvent( field_t *edit, int ch ) { int len; if ( ch == 'v' - 'a' + 1 ) { // ctrl-v is paste Field_Paste( edit ); return; }
functions
backspace if ( edit->cursor > 0 ) { memmove( edit->buffer + edit->cursor - 1, edit->buffer + edit->cursor, len + 1 - edit->cursor ); edit->cursor--; if ( edit->cursor < edit->scroll ) { edit->scroll--; }
functions
0 if ( len == MAX_EDIT_LINE - 2 ) { return; // all full }
functions
void Console_Key (int key) { // ctrl-L clears screen if ( key == 'l' && keys[K_CTRL].down ) { Cbuf_AddText ("clear\n"); return; }
functions
line if ( key == K_ENTER || key == K_KP_ENTER ) { // if not in the game explicitly prepend a slash if needed if ( clc.state != CA_ACTIVE && g_consoleField.buffer[0] && g_consoleField.buffer[0] != '\\' && g_consoleField.buffer[0] != '/' ) { char temp[MAX_EDIT_LINE-1]; Q_strncpyz( temp, g_consoleF...
functions
command if ( g_consoleField.buffer[0] == '\\' || g_consoleField.buffer[0] == '/' ) { Cbuf_AddText( g_consoleField.buffer+1 ); // valid command Cbuf_AddText ("\n"); }
functions
messages if ( !g_consoleField.buffer[0] ) { return; // empty lines just scroll the console without adding to history }
functions
completion if (key == K_TAB) { Field_AutoComplete(&g_consoleField); return; }
functions
scrolling if ( key == K_PGUP ) { Con_PageUp(); return; }
functions
console if ( key == K_HOME && keys[K_CTRL].down ) { Con_Top(); return; }
functions
console if ( key == K_END && keys[K_CTRL].down ) { Con_Bottom(); return; }
functions
void Message_Key( int key ) { char buffer[MAX_STRING_CHARS]; if (key == K_ESCAPE) { Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE ); Field_Clear( &chatField ); return; }
functions
qboolean Key_GetOverstrikeMode( void ) { return key_overstrikeMode; }
functions
void Key_SetOverstrikeMode( qboolean state ) { key_overstrikeMode = state; }
functions
qboolean Key_IsDown( int keynum ) { if ( keynum < 0 || keynum >= MAX_KEYS ) { return qfalse; }
functions
int Key_StringToKeynum( char *str ) { keyname_t *kn; if ( !str || !str[0] ) { return -1; }
functions
match for ( kn=keynames ; kn->name ; kn++ ) { if ( !Q_stricmp( str,kn->name ) ) return kn->keynum; }
functions
string for ( kn=keynames ; kn->name ; kn++ ) { if (keynum == kn->keynum) { return kn->name; }
functions
void Key_SetBinding( int keynum, const char *binding ) { if ( keynum < 0 || keynum >= MAX_KEYS ) { return; }
functions
bindings if ( keys[ keynum ].binding ) { Z_Free( keys[ keynum ].binding ); }
functions
int Key_GetKey(const char *binding) { int i; if (binding) { for (i=0 ; i < MAX_KEYS ; i++) { if (keys[i].binding && Q_stricmp(binding, keys[i].binding) == 0) { return i; }
functions
void Key_Unbind_f (void) { int b; if (Cmd_Argc() != 2) { Com_Printf ("unbind <key> : remove commands from a key\n"); return; }
functions
void Key_Unbindall_f (void) { int i; for (i=0 ; i < MAX_KEYS; i++) if (keys[i].binding) Key_SetBinding (i, ""); }
functions
void Key_Bind_f (void) { int i, c, b; char cmd[1024]; c = Cmd_Argc(); if (c < 2) { Com_Printf ("bind <key> [command] : attach a command to a key\n"); return; }
functions
string for (i=2 ; i< c ; i++) { strcat (cmd, Cmd_Argv(i)); if (i != (c-1)) strcat (cmd, " "); }
functions
void Key_WriteBindings( fileHandle_t f ) { int i; FS_Printf (f, "unbindall\n" ); for (i=0 ; i<MAX_KEYS ; i++) { if (keys[i].binding && keys[i].binding[0] ) { FS_Printf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keys[i].binding); }
functions
void Key_Bindlist_f( void ) { int i; for ( i = 0 ; i < MAX_KEYS ; i++ ) { if ( keys[i].binding && keys[i].binding[0] ) { Com_Printf( "%s \"%s\"\n", Key_KeynumToString(i), keys[i].binding ); }
functions
void Key_CompleteUnbind( char *args, int argNum ) { if( argNum == 2 ) { // Skip "unbind " char *p = Com_SkipTokens( args, 1, " " ); if( p > args ) Field_CompleteKeyname( ); }
functions
void Key_CompleteBind( char *args, int argNum ) { char *p; if( argNum == 2 ) { // Skip "bind " p = Com_SkipTokens( args, 1, " " ); if( p > args ) Field_CompleteKeyname( ); }
functions
else if( argNum >= 3 ) { // Skip "bind <key> " p = Com_SkipTokens( args, 2, " " ); if( p > args ) Field_CompleteCommand( p, qtrue, qtrue ); }
functions
void CL_InitKeyCommands( void ) { // register our functions Cmd_AddCommand ("bind",Key_Bind_f); Cmd_SetCommandCompletionFunc( "bind", Key_CompleteBind ); Cmd_AddCommand ("unbind",Key_Unbind_f); Cmd_SetCommandCompletionFunc( "unbind", Key_CompleteUnbind ); Cmd_AddCommand ("unbindall",Key_Unbindall_f); Cmd_AddComm...
functions
qboolean CL_BindUICommand( const char *cmd ) { if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) return qfalse; if ( !Q_stricmp( cmd, "toggleconsole" ) ) return qtrue; if ( !Q_stricmp( cmd, "togglemenu" ) ) return qtrue; return qfalse; }
functions
void CL_ParseBinding( int key, qboolean down, unsigned time ) { char buf[ MAX_STRING_CHARS ], *p = buf, *end; qboolean allCommands, allowUpCmds; if( clc.state == CA_DISCONNECTED && Key_GetCatcher( ) == 0 ) return; if( !keys[key].binding || !keys[key].binding[0] ) return; Q_strncpyz( buf, keys[key].binding, si...
functions
else if( down ) { // normal commands only execute on key press if ( allCommands || CL_BindUICommand( p ) ) { Cbuf_AddText( p ); Cbuf_AddText( "\n" ); }
functions
void CL_KeyDownEvent( int key, unsigned time ) { keys[key].down = qtrue; keys[key].repeats++; if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK ) anykeydown++; if( keys[K_ALT].down && key == K_ENTER ) { Cvar_SetValue( "r_fullscreen", !Cvar_VariableIntegerValue( "r...
functions
special if ( key == K_ESCAPE ) { if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) { // clear message mode Message_Key( key ); return; }
functions
else if ( clc.state != CA_DISCONNECTED ) { CL_Disconnect_f(); S_StopAllSounds(); VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN ); }
functions
else if ( clc.state == CA_DISCONNECTED ) { Console_Key( key ); }
functions
void CL_KeyUpEvent( int key, unsigned time ) { keys[key].repeats = 0; keys[key].down = qfalse; if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK) anykeydown--; if (anykeydown < 0) { anykeydown = 0; }
functions
void CL_KeyEvent (int key, qboolean down, unsigned time) { if( down ) CL_KeyDownEvent( key, time ); else CL_KeyUpEvent( key, time ); }
functions
void CL_CharEvent( int key ) { // delete is not a printable character and is // otherwise handled by Field_KeyDownEvent if ( key == 127 ) { return; }
functions
else if ( clc.state == CA_DISCONNECTED ) { Field_CharEvent( &g_consoleField, key ); }
functions
void Key_ClearStates (void) { int i; anykeydown = 0; for ( i=0 ; i < MAX_KEYS ; i++ ) { if (i == K_SCROLLOCK || i == K_KP_NUMLOCK || i == K_CAPSLOCK) continue; if ( keys[i].down ) { CL_KeyEvent( i, qfalse, 0 ); }
functions
int Key_GetCatcher( void ) { return keyCatchers; }
functions
void Key_SetCatcher( int catcher ) { // If the catcher state is changing, clear all key states if( catcher != keyCatchers ) Key_ClearStates( ); keyCatchers = catcher; }
functions
void CL_LoadConsoleHistory( void ) { char *token, *text_p; int i, numChars, numLines = 0; fileHandle_t f; consoleSaveBufferSize = FS_FOpenFileRead( CONSOLE_HISTORY_FILE, &f, qfalse ); if( !f ) { Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE ); return; }
functions
void CL_SaveConsoleHistory( void ) { int i; int lineLength, saveBufferLength, additionalLength; fileHandle_t f; consoleSaveBuffer[ 0 ] = '\0'; i = ( nextHistoryLine - 1 ) % COMMAND_HISTORY; do { if( historyEditLines[ i ].buffer[ 0 ] ) { lineLength = strlen( historyEditLines[ i ].buffer ); s...
defines
#define WAITQUEUE_WALK_BREAK_CNT 64
functions
void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *key) { spin_lock_init(&wq_head->lock); lockdep_set_class_and_name(&wq_head->lock, key, name); INIT_LIST_HEAD(&wq_head->head); }
functions
void add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) { unsigned long flags; wq_entry->flags &= ~WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&wq_head->lock, flags); __add_wait_queue(wq_head, wq_entry); spin_unlock_irqrestore(&wq_head->lock, flags); }
functions
void add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) { unsigned long flags; wq_entry->flags |= WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&wq_head->lock, flags); __add_wait_queue_entry_tail(wq_head, wq_entry); spin_unlock_irqrestore(&wq_head->lock, flags); }
functions
void remove_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) { unsigned long flags; spin_lock_irqsave(&wq_head->lock, flags); __remove_wait_queue(wq_head, wq_entry); spin_unlock_irqrestore(&wq_head->lock, flags); }
functions
int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode, int nr_exclusive, int wake_flags, void *key, wait_queue_entry_t *bookmark) { wait_queue_entry_t *curr, *next; int cnt = 0; if (bookmark && (bookmark->flags & WQ_FLAG_BOOKMARK)) { curr = list_next_entry(bookmark, entry); list_del(&bo...
functions
void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int mode, int nr_exclusive, int wake_flags, void *key) { unsigned long flags; wait_queue_entry_t bookmark; bookmark.flags = 0; bookmark.private = NULL; bookmark.func = NULL; INIT_LIST_HEAD(&bookmark.entry); spin_lock_irqsave(&wq_head->lock...
functions
void __wake_up(struct wait_queue_head *wq_head, unsigned int mode, int nr_exclusive, void *key) { __wake_up_common_lock(wq_head, mode, nr_exclusive, 0, key); }
functions
void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr) { __wake_up_common(wq_head, mode, nr, 0, NULL, NULL); }
functions
void __wake_up_locked_key(struct wait_queue_head *wq_head, unsigned int mode, void *key) { __wake_up_common(wq_head, mode, 1, 0, key, NULL); }
functions
void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, unsigned int mode, void *key, wait_queue_entry_t *bookmark) { __wake_up_common(wq_head, mode, 1, 0, key, bookmark); }
functions
void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, int nr_exclusive, void *key) { int wake_flags = 1; /* XXX WF_SYNC */ if (unlikely(!wq_head)) return; if (unlikely(nr_exclusive != 1)) wake_flags = 0; __wake_up_common_lock(wq_head, mode, nr_exclusive, wake_flags, key); }
functions
void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr_exclusive) { __wake_up_sync_key(wq_head, mode, nr_exclusive, NULL); }
functions
void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state) { unsigned long flags; wq_entry->flags &= ~WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&wq_head->lock, flags); if (list_empty(&wq_entry->entry)) __add_wait_queue(wq_head, wq_entry); set_current_state(state); spin_unloc...
functions
void prepare_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state) { unsigned long flags; wq_entry->flags |= WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&wq_head->lock, flags); if (list_empty(&wq_entry->entry)) __add_wait_queue_entry_tail(wq_head, wq_entry); set_current_state...
functions
void init_wait_entry(struct wait_queue_entry *wq_entry, int flags) { wq_entry->flags = flags; wq_entry->private = current; wq_entry->func = autoremove_wake_function; INIT_LIST_HEAD(&wq_entry->entry); }
functions
long prepare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state) { unsigned long flags; long ret = 0; spin_lock_irqsave(&wq_head->lock, flags); if (unlikely(signal_pending_state(state, current))) { /* * Exclusive waiter must not fail if it was selected by wakeup, * ...
functions
int do_wait_intr(wait_queue_head_t *wq, wait_queue_entry_t *wait) { if (likely(list_empty(&wait->entry))) __add_wait_queue_entry_tail(wq, wait); set_current_state(TASK_INTERRUPTIBLE); if (signal_pending(current)) return -ERESTARTSYS; spin_unlock(&wq->lock); schedule(); spin_lock(&wq->lock); return 0; }
functions
int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_entry_t *wait) { if (likely(list_empty(&wait->entry))) __add_wait_queue_entry_tail(wq, wait); set_current_state(TASK_INTERRUPTIBLE); if (signal_pending(current)) return -ERESTARTSYS; spin_unlock_irq(&wq->lock); schedule(); spin_lock_irq(&wq->lock); re...
functions
void finish_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) { unsigned long flags; __set_current_state(TASK_RUNNING); /* * We can check for list emptiness outside the lock * IFF: * - we use the "careful" check that verifies both * the next and prev pointers, so that there cannot...
functions
int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key) { int ret = default_wake_function(wq_entry, mode, sync, key); if (ret) list_del_init(&wq_entry->entry); return ret; }
functions
bool is_kthread_should_stop(void) { return (current->flags & PF_KTHREAD) && kthread_should_stop(); }
functions
long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout) { /* * The below executes an smp_mb(), which matches with the full barrier * executed by the try_to_wake_up() in woken_wake_function() such that * either we see the store to wq_entry->flags in woken_wake_function() * or woken_wake_...
functions
int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key) { /* Pairs with the smp_store_mb() in wait_woken(). */ smp_mb(); /* C */ wq_entry->flags |= WQ_FLAG_WOKEN; return default_wake_function(wq_entry, mode, sync, key); }
includes
#include <stdio.h>
includes
#include <pthread.h>
defines
#define OPTICFLOW_AGL_ID ABI_BROADCAST ///< Default sonar/agl to use in opticflow visual_estimator
defines
#define OPTICFLOW_FPS 0 ///< Default FPS (zero means run at camera fps)
defines
#define OPTICFLOW_FPS_CAMERA2 0 ///< Default FPS (zero means run at camera fps)
defines
#define ACTIVE_CAMERAS 2
defines
#define ACTIVE_CAMERAS 1
functions
void opticflow_telem_send(struct transport_tx *trans, struct link_device *dev) { pthread_mutex_lock(&opticflow_mutex); for (int idx_camera = 0; idx_camera < ACTIVE_CAMERAS; idx_camera++) { if (opticflow_result[idx_camera].noise_measurement < 0.8) { pprz_msg_send_OPTIC_FLOW_EST(trans, dev, AC_ID, ...
functions
void opticflow_module_init(void) { // Initialize the opticflow calculation for (int idx_camera = 0; idx_camera < ACTIVE_CAMERAS; idx_camera++) { opticflow_got_result[idx_camera] = false; }
functions
void opticflow_module_run(void) { pthread_mutex_lock(&opticflow_mutex); // Update the stabilization loops on the current calculation for (int idx_camera = 0; idx_camera < ACTIVE_CAMERAS; idx_camera++) { if (opticflow_got_result[idx_camera]) { uint32_t now_ts = get_sys_time_usec(); AbiSendMsgOPTICA...
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <linux/module.h>
includes
#include <linux/spinlock.h>
includes
#include <linux/tcp.h>
includes
#include <linux/if_vlan.h>
includes
#include <net/busy_poll.h>
includes
#include <linux/clk.h>
includes
#include <linux/if_ether.h>
includes
#include <linux/net_tstamp.h>
includes
#include <linux/phy.h>
functions
int xgbe_alloc_channels(struct xgbe_prv_data *pdata) { struct xgbe_channel *channel_mem, *channel; struct xgbe_ring *tx_ring, *rx_ring; unsigned int count, i; int ret = -ENOMEM; count = max_t(unsigned int, pdata->tx_ring_count, pdata->rx_ring_count); channel_mem = kcalloc(count, sizeof(struct xgbe_channel), GFP...
functions
void xgbe_free_channels(struct xgbe_prv_data *pdata) { if (!pdata->channel) return; kfree(pdata->channel->rx_ring); kfree(pdata->channel->tx_ring); kfree(pdata->channel); pdata->channel = NULL; pdata->channel_count = 0; }