Changeset 1051
- Timestamp:
- 01/21/11 20:04:11 (2 years ago)
- Location:
- trunk/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/ptp.c
r1043 r1051 417 417 418 418 free(buf); 419 420 if ( param3 & PTP_CHDK_ES_WAIT ) 421 { 422 423 while ( script_is_running() ) 424 msleep(100); 425 426 if ( param3 & PTP_CHDK_ES_RESULT ) 419 420 if (script_action_stack < 0) 421 { 422 ptp.code = PTP_RC_InvalidParameter; 423 break; 424 } 425 else 426 { 427 428 if ( param3 & PTP_CHDK_ES_WAIT ) 427 429 { 428 lua_State *Lt; 429 temp_data.lua_state = lua_consume_result();430 Lt = get_lua_thread(temp_data.lua_state);431 temp_data_kind = 2; 432 if ( lua_gettop(Lt) == 0)430 431 while ( script_is_running() ) 432 msleep(100); 433 434 if ( param3 & PTP_CHDK_ES_RESULT ) 433 435 { 434 temp_data_extra = PTP_CHDK_TYPE_NOTHING; 435 } else if ( lua_isnil(Lt,1) ) 436 { 437 temp_data_extra = PTP_CHDK_TYPE_NIL; 438 } else if ( lua_isboolean(Lt,1) ) 439 { 440 temp_data_extra = PTP_CHDK_TYPE_BOOLEAN; 441 } else if ( lua_isnumber(Lt,1) ) 442 { 443 temp_data_extra = PTP_CHDK_TYPE_INTEGER; 444 } else if ( lua_isstring(Lt,1) ) 445 { 446 temp_data_extra = PTP_CHDK_TYPE_STRING; 447 } else { 448 temp_data_extra = PTP_CHDK_TYPE_NOTHING; 449 } 450 ptp.num_param = 1; 451 ptp.param1 = temp_data_extra; 452 if ( temp_data_extra != PTP_CHDK_TYPE_STRING ) 453 { 454 if ( temp_data_extra == PTP_CHDK_TYPE_BOOLEAN ) 455 { 436 lua_State *Lt; 437 temp_data.lua_state = lua_consume_result(); 438 Lt = get_lua_thread(temp_data.lua_state); 439 temp_data_kind = 2; 440 if ( lua_gettop(Lt) == 0 ) 441 { 442 temp_data_extra = PTP_CHDK_TYPE_NOTHING; 443 } else if ( lua_isnil(Lt,1) ) 444 { 445 temp_data_extra = PTP_CHDK_TYPE_NIL; 446 } else if ( lua_isboolean(Lt,1) ) 447 { 448 temp_data_extra = PTP_CHDK_TYPE_BOOLEAN; 449 } else if ( lua_isnumber(Lt,1) ) 450 { 451 temp_data_extra = PTP_CHDK_TYPE_INTEGER; 452 } else if ( lua_isstring(Lt,1) ) 453 { 454 temp_data_extra = PTP_CHDK_TYPE_STRING; 455 } else { 456 temp_data_extra = PTP_CHDK_TYPE_NOTHING; 457 } 458 ptp.num_param = 1; 459 ptp.param1 = temp_data_extra; 460 if ( temp_data_extra != PTP_CHDK_TYPE_STRING ) 461 { 462 if ( temp_data_extra == PTP_CHDK_TYPE_BOOLEAN ) 463 { 464 ptp.num_param = 2; 465 ptp.param2 = lua_toboolean(Lt,1); 466 } if ( temp_data_extra == PTP_CHDK_TYPE_INTEGER ) 467 { 468 ptp.num_param = 2; 469 ptp.param2 = lua_tonumber(Lt,1); 470 } 471 lua_close(Lt); 472 temp_data_kind = 0; 473 } else { 456 474 ptp.num_param = 2; 457 ptp.param2 = lua_toboolean(Lt,1); 458 } if ( temp_data_extra == PTP_CHDK_TYPE_INTEGER ) 459 { 460 ptp.num_param = 2; 461 ptp.param2 = lua_tonumber(Lt,1); 475 ptp.param2 = lua_objlen(Lt,1); 462 476 } 463 lua_close(Lt);464 temp_data_kind = 0;465 } else {466 ptp.num_param = 2;467 ptp.param2 = lua_objlen(Lt,1);468 477 } 469 478 } -
trunk/core/ptp.h
r1005 r1051 18 18 #define PTP_RC_GeneralError 0x2002 19 19 #define PTP_RC_ParameterNotSupported 0x2006 20 #define PTP_RC_InvalidParameter 0x201D 20 21 21 22 // N.B.: unused parameters should be set to 0 -
trunk/core/script.c
r1045 r1051 676 676 long script_start_ptp( char *script , int keep_result ) 677 677 { 678 lua_script_start(script);678 if (!lua_script_start(script)) return -1; 679 679 lua_keep_result = keep_result; 680 680 state_lua_kbd_first_call_to_resume = 1;
Note: See TracChangeset
for help on using the changeset viewer.