event_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) { JSEvent *event; jsint slot, i; JSString *str; const char *name; uint32 temp; if (!JSVAL_IS_INT(id)) return JS_TRUE; event = JS_GetInstancePrivate(cx, obj, &lm_event_class, NULL); if (!event) return JS_TRUE; slot = JSVAL_TO_INT(id); if (slot==EVENT_TYPE) { if (!JSVAL_IS_STRING(*vp) || !(str = JS_ValueToString(cx, *vp))) return JS_FALSE; name = JS_GetStringBytes(str); for (i = 0; i < NUM_EVENTS; i++) { if (!XP_STRCASECMP(event_names[i].lowerName, name)) event->type = PR_BIT(i); } } else if ((slot==EVENT_X) || (slot==EVENT_LAYERX)) return JS_ValueToInt32(cx, *vp, &event->x); else if ((slot==EVENT_Y) || (slot==EVENT_LAYERY)) return JS_ValueToInt32(cx, *vp, &event->y); else if (slot==EVENT_DOCX) return JS_ValueToInt32(cx, *vp, &event->docx); else if (slot==EVENT_DOCY) return JS_ValueToInt32(cx, *vp, &event->docy); else if (slot==EVENT_SCREENX) return JS_ValueToInt32(cx, *vp, &event->screenx); else if (slot==EVENT_SCREENY) return JS_ValueToInt32(cx, *vp, &event->screeny); else if (slot==EVENT_WHICH) return GetUint32(cx, *vp, &event->which); else if (slot==EVENT_MODIFIERS) GetUint32(cx, *vp, &temp); event->modifiers = temp; return JS_TRUE; /* Win16 hack */ /*else if (slot==EVENT_DATA) { GetUint32(cx, *vp, &temp); event->data = temp; return JS_TRUE; } */ return JS_TRUE; }
bool CBasePoly::LoadBasePolyLTA( CLTANode* pNode ) { // CLTANode* pIndicesNode = pNode->getElem(0); // shallow_find_list(pNode, "indices"); CLTANode* pIndex = pNode->GetElement(1); //PairCdrNode(pIndicesNode); uint32 listSize = pIndex->GetNumElements(); assert(listSize > 0); m_Indices.SetSize( listSize - 1 ); for( uint32 i = 1; i < listSize; i++ ) { Index(i-1) = GetUint32(pIndex->GetElement(i)); if( Index(i-1) >= m_pBrush->m_Points ) { Index(i-1) = 0; return false; } } CLTANode* pNormalNode = pNode->GetElement(2); //shallow_find_list(pNode, "normal"); if( pNormalNode ) { Normal().x = GetFloat(pNormalNode->GetElement(1)); Normal().y = GetFloat(pNormalNode->GetElement(2)); Normal().z = GetFloat(pNormalNode->GetElement(3)); } CLTANode* pDistNode = pNode->GetElement(3); //shallow_find_list(pNode, "dist"); if( pDistNode ) { Dist() = GetFloat(PairCdrNode(pDistNode)); } return true; }
static int PaneLayerGetSlot (lua_State * L) { return GetUint32(L, PaneLayer_GetSlot); }
static int PaneItemGetFocusChainSlot (lua_State * L) { return GetUint32(L, PaneItem_GetFocusChainSlot); }
static int TextboxGetSelectCount (lua_State * L) { return GetUint32(L, Textbox_GetSelectCount); }
static int TextboxGetHeldSpot (lua_State * L) { return GetUint32(L, Textbox_GetHeldSpot); }
static int TextboxGetOffset (lua_State * L) { return GetUint32(L, Textbox_GetOffset); }
static int RadioboxGetChoice (lua_State * L) { return GetUint32(L, Radiobox_GetChoice); }
static int ListboxGetInItem (lua_State * L) { return GetUint32(L, Listbox_GetInItem); }
static int ListboxGetCapacity (lua_State * L) { return GetUint32(L, Listbox_GetCapacity); }
static int ListboxGetOffset (lua_State * L) { return GetUint32(L, Listbox_GetOffset); }
static int UserInterfaceGetEventIndex (lua_State * L) { return GetUint32(L, UserInterface_GetEventIndex); }
static int UserInterfaceGetChoice (lua_State * L) { return GetUint32(L, UserInterface_GetChoice); }
static int UserInterfaceGetFrameSize (lua_State * L) { return GetUint32(L, UserInterface_GetFrameSize); }
static int UserInterfaceGetFrameLayer (lua_State * L) { return GetUint32(L, UserInterface_GetFrameLayer); }
static int PaneLayerGetPaneCount (lua_State * L) { return GetUint32(L, PaneLayer_GetPaneCount); }
static int RadioboxGetOptionCount (lua_State * L) { return GetUint32(L, Radiobox_GetOptionCount); }
static int ListboxGetItemContext (lua_State * L) { return GetUint32(L, Listbox_GetItemContext); }
static int RadioboxGetInOption (lua_State * L) { return GetUint32(L, Radiobox_GetInOption); }
static int PaneGetLayer (lua_State * L) { return GetUint32(L, Pane_GetLayer); }
static int TextboxGetCursor (lua_State * L) { return GetUint32(L, Textbox_GetCursor); }
static int PaneGetFocusChainItemCount (lua_State * L) { return GetUint32(L, Pane_GetFocusChainItemCount); }
static int TextboxGetMaxCharCount (lua_State * L) { return GetUint32(L, Textbox_GetMaxCharCount); }
static int PaneGetFocusNextSlot (lua_State * L) { return GetUint32(L, Pane_GetFocusNextSlot); }
static int PaneItemGetPane (lua_State * L) { return GetUint32(L, PaneItem_GetPane); }
uint8_t Set_param(uint8_t *buf) { int16_t i; switch(*(buf + 1)) { case 1: pre_commutation = GetUint16(buf + 2); flash_update = true; break; case 2: Vel_reg.Kp = GetFloat32(buf + 2); flash_update = true; break; case 3: Vel_reg.Ki = GetFloat32(buf + 2); flash_update = true; break; case 4: Vel_reg.Kd = GetFloat32(buf + 2); flash_update = true; break; case 5: add_Uin = GetInt16(buf + 2); flash_update = true; break; case 6: limit_dec_f_force_comm = GetUint16(buf + 2); flash_update = true; break; case 7: current_protection = GetFloat32(buf + 2); flash_update = true; break; case 8: level_pwm_start = GetUint16(buf + 2); flash_update = true; break; case 9: cnt_on_reg_speed = GetUint16(buf + 2); flash_update = true; break; case 10: level_correct_speed = GetUint16(buf + 2); flash_update = true; break; case 11: step_add_velocity = GetFloat32(buf + 2); flash_update = true; break; case 12: step_dec_velocity = GetFloat32(buf + 2); flash_update = true; break; case 13: level_detect_stop = GetUint16(buf + 2); flash_update = true; break; case 14: add_force_time = GetUint32(buf + 2); flash_update = true; break; case 15: step_dec_f_force_comm = GetUint16(buf + 2); flash_update = true; break; case 16: level_on_feedback = GetUint16(buf + 2); flash_update = true; break; case 17: level_pause_detect_ZC = GetUint16(buf + 2); flash_update = true; break; case 18: n_pair_polus = GetUint16(buf + 2); flash_update = true; break; case 19: drive_mode = GetUint16(buf + 2); flash_update = true; break; case 20: Unom = GetFloat32(buf + 2); flash_update = true; break; case 21: current_protect_avg = GetFloat32(buf + 2); flash_update = true; break; case 22: slave_addr = GetFloat32(buf + 2); flash_update = true; break; default: break; } i = 2; return i; }