static void _parse_encode(instance_t *instance,xmlDocPtr doc, xmlNodePtr node) { instance->encode = 1; do { if (node == NULL) break; if (xmlIsBlankNode(node)) continue; if (strcmp(node->name, "nominal-bitrate") == 0) SET_INT(instance->nom_br); else if (strcmp(node->name, "minimum-bitrate") == 0) SET_INT(instance->min_br); else if (strcmp(node->name, "maximum-bitrate") == 0) SET_INT(instance->max_br); else if (strcmp(node->name, "quality") == 0) SET_FLOAT(instance->quality); else if (strcmp(node->name, "samplerate") == 0) SET_INT(instance->samplerate); else if (strcmp(node->name, "channels") == 0) SET_INT(instance->channels); else if (strcmp(node->name, "managed") == 0) SET_INT(instance->managed); else if (strcmp(node->name, "flush-samples") == 0) SET_INT(instance->max_samples_ppage); } while ((node = node->next)); if (instance->max_samples_ppage == 0) instance->max_samples_ppage = instance->samplerate; if (instance->max_samples_ppage < instance->samplerate/100) instance->max_samples_ppage = instance->samplerate/100; }
static void ctl_set( void ) { int i; SET_STR( ctl[ 0 ], sequence, strlen( sequence )); SET_INT( ctl[ 1 ], atom_type ); SET_INT( ctl[ 2 ], atom_nsides ); SET_INT( ctl[ 3 ], atom_nsegments ); for ( i = 0; i < 5; i++ ) SET_FLOAT( ctl[ i + 5 ], atom_radius[ i ] ); SET_INT( ctl[ 10 ], bond_type ); SET_INT( ctl[ 11 ], bond_nsides ); SET_INT( ctl[ 12 ], bond_nsegments ); SET_FLOAT( ctl[ 13 ], bond_radius ); SET_INT( ctl[ 14 ], do_plates ); }
static void set_kernctl( ConvolveInst *inst ) { int i; for ( i = 0; i < 9; i++ ) SET_FLOAT( ctl[ i ], inst->kern[ i / 3 ][ i % 3 ] ); }
LispObject Alloc_MakeFloat(double value) { LispObject o; struct LispFlot *f = (struct LispFlot *)Malloc(sizeof(struct LispFlot)); f->value = value; SET_FLOAT(o, f); return o; }
LispObject GC_MakeFloat(double value) { LispObject o; struct LispFlot *f = FLOAT_NEW(); f->value = value; SET_FLOAT(o, f); return o; }
// HandleList(): void HandleList( LWControl *con, void *data ) { int index, column, other; GET_IVEC( rint->list, index, column, other ); if( index >= (int)rint->swaps.NumElements() ) { index = ((int)rint->swaps.NumElements()) - 1; SET_IVEC( rint->list, index, 1, 0 ); } else { if( index != -1 ) { int x = CON_MOUSEX( con ); int y = CON_MOUSEY( con ); if( x < list_column_widths[0] + 8 ) rint->swaps[ index ]->SetUse( !rint->swaps[ index ]->GetUse() ); } } if( index == -1 ) { SET_STR( rint->path, "", 0 ); SET_FLOAT( rint->weight, 1.0 ); SET_INT( rint->enable, 1 ); GHOST_CON( rint->path ); GHOST_CON( rint->weight ); GHOST_CON( rint->enable ); } else { char * string = (char *)rint->swaps[ index ]->GetFullPath(); if( string == NULL ) { SET_STR( rint->path, "", 0 ); } else { SET_STR( rint->path, string, strlen( string ) ); } SET_FLOAT( rint->weight, rint->swaps[ index ]->GetWeight() ); SET_INT( rint->enable, rint->swaps[ index ]->GetUse() ); UNGHOST_CON( rint->path ); UNGHOST_CON( rint->weight ); UNGHOST_CON( rint->enable ); } }
bool vogl_material_state::restore(const vogl_context_info &context_info) const { VOGL_FUNC_TRACER VOGL_NOTE_UNUSED(context_info); if (!m_valid) { VOGL_ASSERT_ALWAYS; return false; } VOGL_CHECK_GL_ERROR; #define SET_FLOAT(side, pname) set_material_parameter(side, pname) for (uint s = 0; s < cTotalSides; s++) { SET_FLOAT(s, GL_AMBIENT); SET_FLOAT(s, GL_DIFFUSE); SET_FLOAT(s, GL_SPECULAR); SET_FLOAT(s, GL_EMISSION); SET_FLOAT(s, GL_SHININESS); SET_FLOAT(s, GL_COLOR_INDEXES); } #undef GET_FLOAT return !vogl_check_gl_error(); }
bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut ) { ASSERT_M( NOTESKIN != NULL, "The Noteskin Manager must be loaded in order to process mods." ); RString sBit = sOneMod; sBit.MakeLower(); Trim( sBit ); /* "drunk" * "no drunk" * "150% drunk" * "*2 100% drunk": approach at 2x normal speed */ float level = 1; float speed = 1; vector<RString> asParts; split( sBit, " ", asParts, true ); FOREACH_CONST( RString, asParts, s ) { if( *s == "no" ) { level = 0; } else if( isdigit((*s)[0]) || (*s)[0] == '-' ) { /* If the last character is a *, they probably said "123*" when * they meant "*123". */ if( s->Right(1) == "*" ) { // XXX: We know what they want, is there any reason not to handle it? // Yes. We should be strict in handling the format. -Chris sErrorOut = ssprintf("Invalid player options \"%s\"; did you mean '*%d'?", s->c_str(), StringToInt(*s) ); return false; } else { level = StringToFloat( *s ) / 100.0f; } } else if( *s[0]=='*' ) { sscanf( *s, "*%f", &speed ); if( !isfinite(speed) ) speed = 1.0f; } } sBit = asParts.back(); #define SET_FLOAT( opt ) { m_ ## opt = level; m_Speed ## opt = speed; } const bool on = (level > 0.5f); static Regex mult("^([0-9]+(\\.[0-9]+)?)x$"); vector<RString> matches; if( mult.Compare(sBit, matches) ) { StringConversion::FromString( matches[0], level ); SET_FLOAT( fScrollSpeed ) SET_FLOAT( fTimeSpacing ) m_fTimeSpacing = 0; m_fMaxScrollBPM = 0; } else if( sscanf( sBit, "c%f", &level ) == 1 ) { if( !isfinite(level) || level <= 0.0f ) level = CMOD_DEFAULT; SET_FLOAT( fScrollBPM ) SET_FLOAT( fTimeSpacing ) m_fTimeSpacing = 1; m_fMaxScrollBPM = 0; } // oITG's m-mods else if( sscanf( sBit, "m%f", &level ) == 1 ) { // OpenITG doesn't have this block: /* if( !isfinite(level) || level <= 0.0f ) level = CMOD_DEFAULT; */ SET_FLOAT( fMaxScrollBPM ) m_fTimeSpacing = 0; } else if( sBit == "clearall" ) Init(); else if( sBit == "resetspeed" ) { /* level is set to the values from Init() because all speed related fields are being reset to initial values, and they each have different initial values. -kyz */ level= 0; SET_FLOAT(fMaxScrollBPM); SET_FLOAT(fTimeSpacing); level= 1.0f; SET_FLOAT(fScrollSpeed); level= CMOD_DEFAULT; SET_FLOAT(fScrollBPM) }
// MakeMainControls(): bool FreeKeyInterface::MakeMainControls() { try { int x, y, w; // Title Image (OpenGL) if( !( title_image = OPENGL_CTL( panel_funcs->orig_struct, main_panel, "", decoded_logo_small->GetWidth() - 25, decoded_logo_small->GetHeight() ) ) ) throw false; MOVE_CON( title_image, -13, -4 ); // File ItemSelection Conrols if( !( source_scene = FILE_CTL( panel_funcs->orig_struct, main_panel, "Source Scene", 91 ) ) ) throw false; if( !( source_popup = POPDOWN_CTL( panel_funcs->orig_struct, main_panel, "Source Tools", source_popup_text ) ) ) throw false; if( !( output_scene = FILE_CTL( panel_funcs->orig_struct, main_panel, "Output Scene", 91 ) ) ) throw false; if( !( output_popup = POPDOWN_CTL( panel_funcs->orig_struct, main_panel, " Output Tools", output_popup_text ) ) ) throw false; // x = CON_X( source_scene ); // y = CON_Y( source_scene ); // MOVE_CON( source_scene, x, y + 35 ); PanelTools::PutUnder( source_scene, source_scene, -11 ); PanelTools::AlignLabels( source_scene, output_scene, 5 ); PanelTools::PutOnLineWith( source_scene, source_popup, -10 ); PanelTools::PutOnLineWith( output_scene, output_popup, -10 ); // Default Settings for String/File and Popup Controls SET_STR( source_scene, (char *)fk->GetSource(), strlen( fk->GetSource() ) ); SET_STR( output_scene, (char *)fk->GetOutput(), strlen( fk->GetOutput() ) ); const int list_x_offset = 130; // List Controls if( !( list_fold = WBUTTON_CTL( panel_funcs->orig_struct, main_panel, "Fold", 50 ) ) ) throw false; if( !( list_unfold = WBUTTON_CTL( panel_funcs->orig_struct, main_panel, "Unfold", 50 ) ) ) throw false; if( !( select_count = INTRO_CTL( panel_funcs->orig_struct, main_panel, "" ) ) ) throw false; // Display Controls if( !( display_key_mode = WPOPUP_CTL( panel_funcs->orig_struct, main_panel, "Key Mode", display_key_mode_text, 130 ) ) ) throw false; if( !( display_item_mode = WPOPUP_CTL( panel_funcs->orig_struct, main_panel, "Item List", display_mode_text, 130 ) ) ) throw false; SET_INT( display_key_mode, fk->GetKeyDisplayMode() ); SET_INT( display_item_mode, fk->GetItemDisplayMode() ); PanelTools::PutUnder( output_scene, list_fold ); PanelTools::PutUnder( list_fold, list_fold ); x = CON_X( list_fold ); y = CON_Y( list_fold ); MOVE_CON( list_fold, x + 10 + list_x_offset, y-6 ); PanelTools::PutOnLineWith( list_fold, list_unfold, -7 ); PanelTools::PutOnLineWith( list_unfold, select_count, 15); PanelTools::PutOnLineWith( select_count, display_key_mode, 15 ); PanelTools::PutOnLineWith( display_key_mode, display_item_mode ); // Time Controls if( !( item_first_frame = FLOAT_CTL( panel_funcs->orig_struct, main_panel, "Low Frame" ) ) ) throw false; if( !( item_current_frame = FLOAT_CTL( panel_funcs->orig_struct, main_panel, "Current Frame" ) ) ) throw false; if( !( item_jump_to_frame = WBUTTON_CTL( panel_funcs->orig_struct, main_panel, "", 20 ) ) ) throw false; if( !( item_last_frame = FLOAT_CTL( panel_funcs->orig_struct, main_panel, "High Frame" ) ) ) throw false; if( !( item_range_presets = POPDOWN_CTL( panel_funcs->orig_struct, main_panel, " Ranges", item_range_preset_text ) ) ) throw false; SET_FLOAT( item_current_frame, fk->GetCurrentTime() * default_fps ); SET_FLOAT( item_first_frame, fk->GetDisplayMin() * default_fps ); SET_FLOAT( item_last_frame, fk->GetDisplayMax() * default_fps ); PanelTools::PutUnder( list_fold, item_first_frame ); x = CON_X( item_first_frame ); y = CON_Y( item_first_frame ); MOVE_CON( item_first_frame, x + list_x_offset + 40, y ); PanelTools::PutOnLineWith( item_first_frame, item_current_frame, 20 ); PanelTools::PutOnLineWith( item_current_frame, item_jump_to_frame, -5 ); PanelTools::PutOnLineWith( item_jump_to_frame, item_last_frame, 20 ); PanelTools::PutOnLineWith( item_last_frame, item_range_presets, -2 ); // Item List if( !( item_list = CANVAS_CTL( panel_funcs->orig_struct, main_panel, "", 625, 263 ) ) ) throw false; if( !( opengl_item_list = OPENGL_CTL( panel_funcs->orig_struct, main_panel, "", 625, 263 ) ) ) throw false; if( !( item_scroll = VSLIDER_CTL( panel_funcs->orig_struct, main_panel, "", 259, 0, 0 ) ) ) throw false; PanelTools::PutUnder( item_first_frame, item_list ); x = CON_X( item_list ); y = CON_Y( item_list ); MOVE_CON( item_list, x + list_x_offset, y ); MOVE_CON( opengl_item_list, x + list_x_offset, y ); w = CON_W( item_list ); MOVE_CON( item_scroll, x+w-18 + list_x_offset, y ); UpdateItemListType( fk->GetUseOpenGLItemList() ); // MultiSlider/Zoom if( !( item_zoom = PERCENT_CTL( panel_funcs->orig_struct, main_panel, "Zoom" ) ) ) throw false; SET_FLOAT( item_zoom, fk->GetZoom() * 100.0 ); if( !( item_multiscroll = DRAGAREA_CTL( panel_funcs->orig_struct, main_panel, "", 620 + list_x_offset - CON_W( item_zoom ) - 1, 16 ) ) ) throw false; PanelTools::PutUnder( item_list, item_zoom ); x = CON_X( item_zoom ); y = CON_Y( item_zoom ); MOVE_CON( item_zoom, x+8, y ); PanelTools::PutOnLineWith( item_zoom, item_multiscroll ); x = CON_X( item_multiscroll ); y = CON_Y( item_multiscroll ); MOVE_CON( item_multiscroll, x, y+1 ); // Tabs if( !( tool_options_tabs = TABCHOICE_CTL( panel_funcs->orig_struct, main_panel, "", tool_option_tab_text ) ) ) throw false; PanelTools::PutUnder( item_multiscroll, tool_options_tabs ); PanelTools::PutUnder( tool_options_tabs, tool_options_tabs ); // Group List if( !( group_list = CUSTPOPUP_CTL( panel_funcs->orig_struct, main_panel, "Group", 200, GroupNames, GroupCount ) ) ) throw false; PanelTools::PutOnLineWith( tool_options_tabs, group_list, 12 ); x = CON_X( group_list ); y = CON_Y( group_list ); MOVE_CON( group_list, x, y-5 ); // About FreeKey button if( !( about = WBUTTON_CTL( panel_funcs->orig_struct, main_panel, "About", 63 ) ) ) throw false; // F1 (Keyboard Help) Button if( !( f1 = WBUTTON_CTL( panel_funcs->orig_struct, main_panel, "F1", 30 ) ) ) throw false; PanelTools::PutOnLineWith( group_list, about ); PanelTools::PutOnLineWith( about, f1 ); // Range Controls if( !( range_low = MINISLIDER_CTL( panel_funcs->orig_struct, main_panel, "Range Low", 30, 0, 1000000 ) ) ) throw false; if( !( range_high = MINISLIDER_CTL( panel_funcs->orig_struct, main_panel, "High", 30, 0, 1000000 ) ) ) throw false; SET_INT( range_high, 1000000 ); PanelTools::PutUnder( tool_options_tabs, range_low ); PanelTools::PutUnder( range_low, range_low ); PanelTools::PutUnder( range_low, range_low ); PanelTools::PutUnder( range_low, range_low ); PanelTools::PutUnder( range_low, range_low ); PanelTools::PutOnLineWith( range_low, range_high ); // Remove Mode if( !( remove_mode = WPOPUP_CTL( panel_funcs->orig_struct, main_panel, "Remove Mode", remove_mode_text, 250 ) ) ) throw false; PanelTools::PutOnLineWith( range_high, remove_mode, 20 ); y = CON_Y( remove_mode ); MOVE_CON( remove_mode, 325, y ); // Step if( !( step_amount = MINISLIDER_CTL( panel_funcs->orig_struct, main_panel, "Step Amount", 30, 0, 32767 ) ) ) throw false; if( !( step_mode = WPOPUP_CTL( panel_funcs->orig_struct, main_panel, "Step Mode", step_mode_text, 250 ) ) ) throw false; PanelTools::PutUnder( range_low, step_amount ); PanelTools::PutOnLineWith( step_amount, step_mode ); // Delta if( !( delta_amount = MINISLIDER_CTL( panel_funcs->orig_struct, main_panel, "Delta Amount", 30, -32768, 32767 ) ) ) throw false; if( !( delta_mode = BOOL_CTL( panel_funcs->orig_struct, main_panel, "Enable Time Delta" ) ) ) throw false; PanelTools::PutUnder( step_amount, delta_amount ); PanelTools::PutOnLineWith( delta_amount, delta_mode ); // Direction if( !( direction_mode = WPOPUP_CTL( panel_funcs->orig_struct, main_panel, "Direction", direction_mode_text, 250 ) ) ) throw false; PanelTools::PutOnLineWith( delta_amount, direction_mode ); // Scale if( !( scale_amount = FLOAT_CTL( panel_funcs->orig_struct, main_panel, "Scale Factor" ) ) ) throw false; if( !( scale_mode = BOOL_CTL( panel_funcs->orig_struct, main_panel, "Enable Scale Keys" ) ) ) throw false; PanelTools::PutUnder( delta_amount, scale_amount ); PanelTools::PutOnLineWith( scale_amount, scale_mode ); // Fix Some Alignments LWControl *align1[] = { range_low, step_amount, delta_amount, scale_amount, NULL }; PanelTools::AlignLabels( align1 ); PanelTools::PutOnLineWith( range_low, range_high ); LWControl *align2[] = { remove_mode, step_mode, direction_mode, NULL }; PanelTools::AlignLabels( align2 ); PanelTools::PutOnLineWith( delta_amount, delta_mode ); x = CON_X( delta_mode ); y = CON_Y( scale_mode ); MOVE_CON( scale_mode, x, y ); // Status Line if( !( status_line = CANVAS_CTL( panel_funcs->orig_struct, main_panel, // Compare Mode pop-up "", 600, 15 ) ) ) throw false; PanelTools::PutUnder( scale_amount, status_line ); PanelTools::PutUnder( status_line, status_line ); // FreeKey-ify button if( !( freekey = WBUTTON_CTL( panel_funcs->orig_struct, main_panel, "FreeKey-ify!", 150 ) ) ) throw false; PanelTools::PutOnLineWith( status_line, freekey, -8 ); // Right-Align the F1 Button int x2 = CON_X( item_scroll ); int w2 = CON_W( item_scroll ); y = CON_Y( f1 ); w = CON_W( f1 ); MOVE_CON( f1, x2+w2-w, y ); // Move the About Button just to the left of the F1 Button y = CON_Y( about ); w = CON_W( about ); x = CON_X( f1 ); MOVE_CON( about, x-w+5, y ); PAN_SETW( panel_funcs->orig_struct, main_panel, decoded_logo_small->GetWidth() - 30 ); // Envent Handler Functions CON_SETEVENT( about, OnAbout, this ); CON_SETEVENT( source_scene, OnSourceFile, this ); CON_SETEVENT( output_scene, OnOutputFile, this ); CON_SETEVENT( source_popup, OnSourcePopup, this ); CON_SETEVENT( output_popup, OnOutputPopup, this ); CON_SETEVENT( item_first_frame, OnFirstFrame, this ); CON_SETEVENT( item_last_frame, OnLastFrame, this ); CON_SETEVENT( item_range_presets, OnItemRangePresets, this ); CON_SETEVENT( item_scroll, OnItemScroll, this ); CON_SETEVENT( item_multiscroll, OnItemMultiScroll2, this ); CON_SETEVENT( item_zoom, OnItemZoom, this ); CON_SETEVENT( list_fold, OnFoldList, this ); CON_SETEVENT( list_unfold, OnUnFoldList, this ); CON_SETEVENT( display_key_mode, OnKeyFrameMode, this ); CON_SETEVENT( display_item_mode, OnDisplayMode, this ); CON_SETEVENT( tool_options_tabs, OnToolOptionsTabs, this ); CON_SETEVENT( group_list, OnGroupList, this ); CON_SETEVENT( range_low, OnRangeLow, this ); CON_SETEVENT( range_high, OnRangeHigh, this ); CON_SETEVENT( remove_mode, OnRemoveMode, this ); CON_SETEVENT( step_amount, OnStepAmount, this ); CON_SETEVENT( step_mode, OnStepMode, this ); CON_SETEVENT( delta_amount, OnDeltaAmount, this ); CON_SETEVENT( delta_mode, OnDeltaMode, this ); CON_SETEVENT( scale_amount, OnScaleAmount, this ); CON_SETEVENT( scale_mode, OnScaleMode, this ); CON_SETEVENT( direction_mode, OnDirectionMode, this ); CON_SETEVENT( f1, OnF1, this ); CON_SETEVENT( freekey, OnFreeKey, this ); CON_SETEVENT( item_list, OnItemList, this ); // CON_SETEVENT( opengl_item_list, OnItemList, this ); // Set the Draw Functions ival.intv.value = (int)&DrawItemJumpToFrame; (*item_jump_to_frame->set)( item_jump_to_frame, CTL_USERDRAW, &ival ); ival.intv.value = (int)&DrawItemListbox; (*item_list->set)( item_list, CTL_USERDRAW, &ival ); // For some inexplicable reason, the draw function is an event for OpenGL controls. Go fig. // ival.intv.value = (int)&DrawOpenGLItemListbox; // (*opengl_item_list->set)( opengl_item_list, CTL_USERDRAW, &ival ); CON_SETEVENT( opengl_item_list, DrawOpenGLItemListbox, this ); ival.intv.value = (int)&DrawItemMultiScroll; (*item_multiscroll->set)( item_multiscroll, CTL_USERDRAW, &ival ); ival.intv.value = (int)&DrawStatusLine; (*status_line->set)( status_line, CTL_USERDRAW, &ival ); CON_SETEVENT( title_image, DrawTitleImage, this ); return true; } catch( bool ) { return false; } return true; }
void RPLConfig_FillDefaults( TRPLConfig *p_poRPLConfig ) { p_poRPLConfig->m_u16RplConfigSize = sizeof(TRPLConfig); p_poRPLConfig->m_u8AllowConfigSet = 1; p_poRPLConfig->m_u8RplToMacMaxInPacketsPerPoll = 10; p_poRPLConfig->m_u8NeighMaxMissConf = 3; p_poRPLConfig->m_u8NeighMinConfNo = 3; p_poRPLConfig->m_u8LowPowerDisFactorSec = 2; #if defined(TRANSCEIVER_SUPPORT) p_poRPLConfig->m_u16NeighborProbeRateMinSec = 2; // seconds p_poRPLConfig->m_u16NeighborProbeRateIfNoRxSec = 2; p_poRPLConfig->m_u16NeighborProbeRateIfRxSec = 2; p_poRPLConfig->m_nDAODelay = 10; p_poRPLConfig->m_nBroadcastDelayIntervalMS = 30000; //ms #else p_poRPLConfig->m_u16NeighborProbeRateMinSec = 60; // seconds p_poRPLConfig->m_u16NeighborProbeRateIfNoRxSec = 150; p_poRPLConfig->m_u16NeighborProbeRateIfRxSec = 600; p_poRPLConfig->m_nDAODelay = 20 * 1000; p_poRPLConfig->m_nBroadcastDelayIntervalMS = 30000; #endif p_poRPLConfig->m_u16NeighborPenaltyTime = 660; p_poRPLConfig->m_u16ChildAssumeTime = 660; p_poRPLConfig->m_u16InstanceLogPeriodSec = 900; #if defined(OS_MQX) p_poRPLConfig->m_nMaxDAODelayMSec = 2 * 3600 * 1000; #else p_poRPLConfig->m_nMaxDAODelayMSec = 4 * 3600 * 1000; #endif p_poRPLConfig->m_nRIBCleanupInterval = DEFAULT_RIB_CLEANUP_INTERVAL; p_poRPLConfig->m_u8TopologyInStoringMode = 1; p_poRPLConfig->m_u8RPLInstanceId = DEFAULT_RPL_INSTANCE_ID; p_poRPLConfig->m_u8DTSN = DEFAULT_DTSN; SET_PRF( p_poRPLConfig, DEFAULT_DAG_PREFERENCE ); #ifdef STORING_MODE SET_MOP( p_poRPLConfig, MOP_STORING_WITHOUT_MULTICAST ); #else SET_MOP( p_poRPLConfig, MOP_NON_STORING ); #endif SET_FLOAT( p_poRPLConfig, READ_YES_NO( DEFAULT_FLOATING_BEHAVIOR ) ); SET_POISON( p_poRPLConfig, READ_YES_NO( DEFAULT_POISON_BROKEN_PATH ) ); SET_REPAIR( p_poRPLConfig, READ_YES_NO( DEFAULT_TRIGGER_LOCAL_REPAIR ) ); SET_TUNNEL( p_poRPLConfig, READ_YES_NO( DEFAULT_TUNNEL_DP_OPTION ) ); SET_ISTR( p_poRPLConfig, READ_YES_NO( DEFAULT_IS_TRANSCEIVER ) ); p_poRPLConfig->m_nRplToMacFrameTimeoutMS = 60 * 1000; //ms p_poRPLConfig->m_u8RplToMacMaxFrameRetryNo = 0; // p_poRPLConfig->m_u8RplToMacMaxOutRetryFrames = 2; // p_poRPLConfig->m_u8RplToMacDropFrameOnFullQ = 1; p_poRPLConfig->m_nWiredRplToMacFrameTimeoutMS = 5 * 1000; //5s p_poRPLConfig->m_u8WiredRplToMacMaxFrameRetryNo = 2; // p_poRPLConfig->m_u8WiredRplToMacMaxOutRetryFrames = 2; // #if defined (OS_MQX) p_poRPLConfig->m_nWiredPort = 1; // #if defined(TOWER_HW_PLATFORM) p_poRPLConfig->m_nWiredPort = 3; // #endif #else p_poRPLConfig->m_nWiredPort = 2; // #endif p_poRPLConfig->m_nWiredPortBaud = 115200; // // PIO memset( &p_poRPLConfig->m_oPrefixInformation, 0, sizeof( p_poRPLConfig->m_oPrefixInformation ) ); #ifdef RPL_ROOT Ipv6Prefix_Parse( &p_poRPLConfig->m_oPrefixInformation.m_oPrefix, DEFAULT_PREFIX ); #endif p_poRPLConfig->m_oPrefixInformation.m_u1L = READ_YES_NO( DEFAULT_ON_LINK ); p_poRPLConfig->m_oPrefixInformation.m_u1A = READ_YES_NO( DEFAULT_AAC ); p_poRPLConfig->m_oPrefixInformation.m_u1R = READ_YES_NO( DEFAULT_RADDRESS ); p_poRPLConfig->m_oPrefixInformation.m_u32ValidLifetime = DEFAULT_VALID_LIFETIME; p_poRPLConfig->m_oPrefixInformation.m_u32PreferredLifetime = DEFAULT_PREFFERED_LIFETIME; p_poRPLConfig->m_oPrefixInformation.m_u1ValidPrefixInfo = TRUE; // lifetimes p_poRPLConfig->m_nRplHistoryElementLifetimeSec = DEFAULT_HISTORYELEMENT_LIFETIME_SEC; p_poRPLConfig->m_u16RplHistoryCleanupIntervalSec = DEFAULT_HISTORY_CLEANUP_INTERVAL_SEC; p_poRPLConfig->m_u16RouteInfoCleanupIntervalSec = DEFAULT_ROUTEINFO_CLEANUP_INTERVAL_SEC; p_poRPLConfig->m_nRoutesPoisonIntervalMSec = 8 * 1000; // ms p_poRPLConfig->m_u8RoutesPoisonMaxTries = 0; // OF0 p_poRPLConfig->m_u8LinkQualityCompress = 7; p_poRPLConfig->m_nRankFactor = (uint8_t)DEFAULT_RANK_FACTOR; p_poRPLConfig->m_nStretchOfRank = (uint8_t)DEFAULT_RANK_STRETCH; p_poRPLConfig->m_u16RankThreshold = DEFAULT_OF_RANK_THRESHOLD; p_poRPLConfig->m_u16RankThresholdForDODAGSwitch = DEFAULT_OF_RANK_THRESHOLD_ForDODAGSwitch; p_poRPLConfig->m_u16RankThresholdOnSameParent = DEFAULT_OF_RANK_THRESHOLD_OnSameParent; // DIS p_poRPLConfig->m_u8RplDISModeSilent = 1; p_poRPLConfig->m_u8NbOfDISToSend = 10; p_poRPLConfig->m_nIntervalToSendDISmsec = 180 * 1000; #ifdef SIXLOWPAN_COMPRESSION p_poRPLConfig->m_u8SixlowpanRF = 1; #if defined(UNIT_TEST_RPL) || defined(UNIT_TEST_APP) || defined(RPL_TEST) p_poRPLConfig->m_u8SixlowpanWired = 1; #else p_poRPLConfig->m_u8SixlowpanWired = 0; #endif #else p_poRPLConfig->m_u8SixlowpanRF = 0; #endif // SIXLOWPAN_COMPRESSION #ifdef RPL_ROOT NList_Init( &p_poRPLConfig->m_oRouteInformations ); p_poRPLConfig->m_u8PathControlSize = DEFAULT_PATH_CONTROL_SIZE; p_poRPLConfig->m_u8DIOIntervalDoublings = DEFAULT_DIO_INTERVAL_DOUBLINGS; p_poRPLConfig->m_u8DIOIntervalMin = DEFAULT_DIO_INTERVAL_MIN; p_poRPLConfig->m_u8DIORedundancyConstant = DEFAULT_DIO_REDUNDANCY_CONSTANT; p_poRPLConfig->m_u8Lifetime = DEFAULT_LIFETIME; p_poRPLConfig->m_u16MaxRankIncrease = DEFAULT_MAX_RANK_INCREASE; p_poRPLConfig->m_u16MinHopRankIncrease = DEFAULT_MIN_HOP_RANK_INCREASE; p_poRPLConfig->m_u16LifetimeUnit = DEFAULT_LIFETIME_UNIT; RplSequenceCounter_Init( &p_poRPLConfig->m_oDODAGVersionNumber ); Ipv6Addr_Zero( &p_poRPLConfig->m_oIpv6Address ); #ifdef SIXLOWPAN_COMPRESSION NList_Init(&p_poRPLConfig->m_oContexts); #endif // SIXLOWPAN_COMPRESSION #endif // RPL_ROOT #ifdef RPL_NODE p_poRPLConfig->m_nDodagSelectionIntervalMSec = DEFAULT_DODAG_SELECTION_INTERVAL; // DAO-ack SET_DAREN( p_poRPLConfig, 1 ); p_poRPLConfig->m_u16DaoAckReqIntervalSec = 60; p_poRPLConfig->m_u8NbOfDaoAckReqToSend = 2; // TCP & UDP servers SET_TCPEN(p_poRPLConfig, 1); p_poRPLConfig->m_usTcpServerListen = 23; p_poRPLConfig->m_usNetStatLocalPort = 44965; p_poRPLConfig->m_usNmsNetStatPort = 44965; p_poRPLConfig->m_usUdpCommStatsLocalPort = 33333; memset(p_poRPLConfig->m_oNmsVirtualIPv6.m_pucBytes, 0, IPV6_ADDR_LEN) ; p_poRPLConfig->m_oNmsVirtualIPv6.m_pucBytes[0] = 0x20; p_poRPLConfig->m_oNmsVirtualIPv6.m_pucBytes[1] = 0x05; p_poRPLConfig->m_oNmsVirtualIPv6.m_pucBytes[2] = 0x00; p_poRPLConfig->m_oNmsVirtualIPv6.m_pucBytes[3] = 0x01; p_poRPLConfig->m_oNmsVirtualIPv6.m_pucBytes[15] = 0x01; // net stat publish settings PublishConfig_Init( &p_poRPLConfig->m_oPublishNetStat ); PublishConfig_Init( &p_poRPLConfig->m_oPublishRplDodag ); PublishConfig_Init( &p_poRPLConfig->m_oPublishRplInstance ); PublishConfig_Init( &p_poRPLConfig->m_oPublishRadioStats ); #ifdef SIM_METER_APP PublishConfig_Init( &p_poRPLConfig->m_oPublishMeterSnap ); PublishConfig_Init( &p_poRPLConfig->m_oPublishMeterLp ); #endif #if ! defined(OS_NON_RTOS) && ! defined (PUBLISHER_TASK) #ifdef OS_EMBOS // default publish p_poRPLConfig->m_oPublishRplInstance.m_bEnabled = 1; p_poRPLConfig->m_oPublishRplInstance.m_u32StartTime = 0; p_poRPLConfig->m_oPublishRplInstance.m_u32EndTime = 0xFFffFFff; p_poRPLConfig->m_oPublishRplInstance.m_u32Interval = 3600; p_poRPLConfig->m_oPublishNetStat.m_bEnabled = 1; p_poRPLConfig->m_oPublishNetStat.m_u32StartTime = 0; p_poRPLConfig->m_oPublishNetStat.m_u32EndTime = 0xFFffFFff; p_poRPLConfig->m_oPublishNetStat.m_u32Interval = 3600; p_poRPLConfig->m_oPublishRadioStats.m_bEnabled = 1; p_poRPLConfig->m_oPublishRadioStats.m_u32StartTime = 0; p_poRPLConfig->m_oPublishRadioStats.m_u32EndTime = 0xFFffFFff; p_poRPLConfig->m_oPublishRadioStats.m_u32Interval = 3600; p_poRPLConfig->m_oPublishRplDodag.m_bEnabled = 1; p_poRPLConfig->m_oPublishRplDodag.m_u32StartTime = 0; p_poRPLConfig->m_oPublishRplDodag.m_u32EndTime = 0xFFffFFff; p_poRPLConfig->m_oPublishRplDodag.m_u32Interval = 3600; #else #ifdef NET_WITH_MAX_100_DEVICE // remove network stats on quark #else // default publish for first p_poRPLConfig->m_oPublishNetStat.m_bEnabled = 1; p_poRPLConfig->m_oPublishNetStat.m_u32StartTime = 0; p_poRPLConfig->m_oPublishNetStat.m_u32EndTime = 0xFFffFFff; p_poRPLConfig->m_oPublishNetStat.m_u32Interval = 30; #endif #endif #endif #endif #if defined (OS_MQX) p_poRPLConfig->m_nRplNLogLevel = (int)RPL_NLOG_LVL_NONE; #else p_poRPLConfig->m_nRplNLogLevel = (int)RPL_NLOG_LVL_INF; #endif #ifdef SUMITOMO_COORDINATOR uint8_t u8Prefix[8] = {0x20, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; memset(p_poRPLConfig->m_u8GPrefixBuff, 0, sizeof(p_poRPLConfig->m_u8GPrefixBuff)); memcpy(p_poRPLConfig->m_u8GPrefixBuff, u8Prefix, sizeof(u8Prefix)); p_poRPLConfig->m_u8GPrefixLen = 64; #endif }
int open_sliderpan( LWPanelFuncs *panf ) { LWPanControlDesc desc; LWValue ival = { LWT_INTEGER }, fval = { LWT_FLOAT }; LWPanelID panel; LWControl *ctl[ 10 ]; int n, w, ok; if( !( panel = PAN_CREATE( panf, "Slider" ))) return 0; panf->set( panel, PAN_USERDATA, panf ); panf->set( panel, PAN_MOUSEBUTTON, mevent ); panf->set( panel, PAN_MOUSEMOVE, mevent ); ctl[ 0 ] = SLIDER_CTL( panf, panel, "Slider", 100, -20, 100 ); ctl[ 1 ] = VSLIDER_CTL( panf, panel, "Vertical Slider", 60, 0, 100 ); ctl[ 2 ] = HSLIDER_CTL( panf, panel, "Horizontal Slider", 100, -20, 100 ); ctl[ 3 ] = UNSLIDER_CTL( panf, panel, "Unbounded Slider", 100, -20, 100 ); ctl[ 4 ] = MINISLIDER_CTL( panf, panel, "Minislider", 100, -20, 100 ); ctl[ 5 ] = PERCENT_CTL( panf, panel, "Percent" ); ctl[ 6 ] = ANGLE_CTL( panf, panel, "Angle" ); ctl[ 7 ] = DRAGBUT_CTL( panf, panel, "Drag Button", 40, 40 ); ctl[ 8 ] = VDRAGBUT_CTL( panf, panel, "Vertical Drag Button" ); ctl[ 9 ] = HDRAGBUT_CTL( panf, panel, "Horizontal Drag Button" ); CON_SETEVENT( ctl[ 1 ], sevent, NULL ); CON_SETEVENT( ctl[ 2 ], sevent, NULL ); CON_SETEVENT( ctl[ 7 ], devent, NULL ); CON_SETEVENT( ctl[ 8 ], devent, NULL ); CON_SETEVENT( ctl[ 9 ], devent, NULL ); /* align */ for ( n = 0; n < 10; n++ ) { w = CON_LW( ctl[ n ] ); ival.intv.value = 100 - w; ctl[ n ]->set( ctl[ n ], CTL_X, &ival ); } for ( n = 0; n < 5; n++ ) SET_INT( ctl[ n ], slideval[ n ] ); SET_FLOAT( ctl[ 5 ], pct ); SET_FLOAT( ctl[ 6 ], angle ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL | PANF_MOUSETRAP ); if ( ok ) { for ( n = 0; n < 5; n++ ) GET_INT( ctl[ n ], slideval[ n ] ); GET_FLOAT( ctl[ 5 ], pct ); GET_FLOAT( ctl[ 6 ], angle ); } PAN_KILL( panf, panel ); return 1; }
XCALL_(int)BlotchInterface ( long version, GlobalFunc *global, Blotch *inst, void *serverData) { LWPanelFuncs *panl; LWPanelID panID; LWControl *col,*cen,*sof,*rad; MessageFuncs *message; int x=200,y=0,w=400,h=300; XCALL_INIT; if (version != 1) return AFUNC_BADVERSION; message = (*global) ("Info Messages", GFUSE_TRANSIENT); if (!message ) return AFUNC_BADGLOBAL; panl = (*global) (PANEL_SERVICES_NAME, GFUSE_TRANSIENT); if(!panl) { (*message->error)("Unable to activate global "PANEL_SERVICES_NAME, " please add plugin lwpanels.p" ); return AFUNC_BADGLOBAL; } if( panID=PAN_CREATE(panl,"Blotch") ) { LWValue val = {LWT_INTEGER}; int lw; #ifdef RGB int rgb[3]; if(!(col = MINIRGB_CTL(panl,panID,"Color"))) goto controlError; #else if(!(col = MINIHSV_CTL(panl,panID,"Color"))) goto controlError; #endif if(!(cen = FVEC_CTL(panl,panID,"Center"))) goto controlError; if(!(rad = FLOAT_CTL(panl,panID,"Radius"))) goto controlError; if(!(sof = FLOAT_CTL(panl,panID,"Softness"))) goto controlError; lw = maxLabel(panl,panID); ctlVAlign(lw,col); ctlVAlign(lw,cen); ctlVAlign(lw,rad); ctlOneLine(rad,sof,NULL,NULL,NULL,NULL); #ifdef RGB rgb[0] = (int)(255.0*inst->color[0]); rgb[1] = (int)(255.0*inst->color[1]); rgb[2] = (int)(255.0*inst->color[2]); SETV_IVEC(col,rgb); #else SETV_FVEC(col,inst->color); #endif SETV_FVEC(cen,inst->center); SET_FLOAT(rad,inst->radius); SET_FLOAT(sof,inst->softness); if(PAN_POST(panl,panID)) { #ifdef RGB GETV_IVEC(col,rgb); inst->color[0] = ((double)rgb[0])/255.0; inst->color[1] = ((double)rgb[1])/255.0; inst->color[2] = ((double)rgb[2])/255.0; #else GETV_FVEC(col,inst->color); #endif GETV_FVEC(cen,inst->center); GET_FLOAT(rad,inst->radius); GET_FLOAT(sof,inst->softness); } PAN_KILL(panl,panID); return (AFUNC_OK); controlError: PAN_KILL(panl,panID); (*message->error)("Duoooh!:","Unable to create panel"); } else { (*message->error)("Duoooh!:","Unable to create panel"); } return AFUNC_BADGLOBAL; }