Lines 421-449
unsigned char * codeSnippet(
Link Here
|
421 |
|
421 |
|
422 |
} |
422 |
} |
423 |
|
423 |
|
424 |
void ** bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block) |
424 |
struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; }; |
425 |
{ |
425 |
|
426 |
return static_cast< void ** >(block) + 2; |
426 |
bridges::cpp_uno::shared::VtableFactory::Slot * |
|
|
427 |
bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block) { |
428 |
return static_cast< Slot * >(block) + 2; |
427 |
} |
429 |
} |
428 |
|
430 |
|
429 |
sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( |
431 |
sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( |
430 |
sal_Int32 slotCount) |
432 |
sal_Int32 slotCount) |
431 |
{ |
433 |
{ |
432 |
return (slotCount + 2) * sizeof (void *) + slotCount * codeSnippetSize; |
434 |
return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize; |
433 |
} |
435 |
} |
434 |
|
436 |
|
435 |
void ** bridges::cpp_uno::shared::VtableFactory::initializeBlock(void * block) { |
437 |
bridges::cpp_uno::shared::VtableFactory::Slot * |
436 |
void ** slots = mapBlockToVtable(block); |
438 |
bridges::cpp_uno::shared::VtableFactory::initializeBlock( |
437 |
slots[-2] = 0; |
439 |
void * block, sal_Int32 slotCount) |
438 |
slots[-1] = 0; |
440 |
{ |
439 |
return slots; |
441 |
Slot * slots = mapBlockToVtable(block); |
|
|
442 |
slots[-2].fn = 0; |
443 |
slots[-1].fn = 0; |
444 |
return slots + slotCount; |
440 |
} |
445 |
} |
441 |
|
446 |
|
442 |
unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( |
447 |
unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( |
443 |
void ** slots, unsigned char * code, |
448 |
Slot ** slots, unsigned char * code, |
444 |
typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset, |
449 |
typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset, |
445 |
sal_Int32 /*functionCount*/, sal_Int32 vtableOffset) |
450 |
sal_Int32 functionCount, sal_Int32 vtableOffset) |
446 |
{ |
451 |
{ |
|
|
452 |
(*slots) -= functionCount; |
453 |
Slot * s = *slots; |
447 |
for (sal_Int32 i = 0; i < type->nMembers; ++i) { |
454 |
for (sal_Int32 i = 0; i < type->nMembers; ++i) { |
448 |
typelib_TypeDescription * member = 0; |
455 |
typelib_TypeDescription * member = 0; |
449 |
TYPELIB_DANGER_GET(&member, type->ppMembers[i]); |
456 |
TYPELIB_DANGER_GET(&member, type->ppMembers[i]); |
Lines 451-457
unsigned char * bridges::cpp_uno::shared
Link Here
|
451 |
switch (member->eTypeClass) { |
458 |
switch (member->eTypeClass) { |
452 |
case typelib_TypeClass_INTERFACE_ATTRIBUTE: |
459 |
case typelib_TypeClass_INTERFACE_ATTRIBUTE: |
453 |
// Getter: |
460 |
// Getter: |
454 |
*slots++ = code; |
461 |
(s++)->fn = code; |
455 |
code = codeSnippet( |
462 |
code = codeSnippet( |
456 |
code, functionOffset++, vtableOffset, |
463 |
code, functionOffset++, vtableOffset, |
457 |
reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( |
464 |
reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( |
Lines 461-467
unsigned char * bridges::cpp_uno::shared
Link Here
|
461 |
typelib_InterfaceAttributeTypeDescription * >( |
468 |
typelib_InterfaceAttributeTypeDescription * >( |
462 |
member)->bReadOnly) |
469 |
member)->bReadOnly) |
463 |
{ |
470 |
{ |
464 |
*slots++ = code; |
471 |
(s++)->fn = code; |
465 |
code = codeSnippet( |
472 |
code = codeSnippet( |
466 |
code, functionOffset++, vtableOffset, |
473 |
code, functionOffset++, vtableOffset, |
467 |
typelib_TypeClass_VOID); |
474 |
typelib_TypeClass_VOID); |
Lines 469-475
unsigned char * bridges::cpp_uno::shared
Link Here
|
469 |
break; |
476 |
break; |
470 |
|
477 |
|
471 |
case typelib_TypeClass_INTERFACE_METHOD: |
478 |
case typelib_TypeClass_INTERFACE_METHOD: |
472 |
*slots++ = code; |
479 |
(s++)->fn = code; |
473 |
code = codeSnippet( |
480 |
code = codeSnippet( |
474 |
code, functionOffset++, vtableOffset, |
481 |
code, functionOffset++, vtableOffset, |
475 |
reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( |
482 |
reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( |