@@ -1039,14 +1039,14 @@ static VMA resolveImmediateConstant(PlanarMemory<MEDIA_MACHINE_TYPE_COUNT> &memo
10391039 }
10401040}
10411041
1042- MediaMachine machine_create (const ReadableString& code) {
1042+ MediaMachine mediaMachine_create (const ReadableString& code) {
10431043 Handle<PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>> memory = handle_create<MediaMemory>().setName (" MediaMemory" );
10441044 static const int32_t mediaMachineInstructionCount = sizeof (mediaMachineInstructions) / sizeof (InsSig<MEDIA_MACHINE_TYPE_COUNT>);
10451045 static const int32_t mediaMachineTypeCount = sizeof (mediaMachineTypes) / sizeof (VMTypeDef<MEDIA_MACHINE_TYPE_COUNT>);
10461046 return MediaMachine (handle_create<VirtualMachine<MEDIA_MACHINE_TYPE_COUNT>>(code, memory, mediaMachineInstructions, mediaMachineInstructionCount, mediaMachineTypes, mediaMachineTypeCount, resolveImmediateConstant).setName (" MediaMachine" ));
10471047}
10481048
1049- void machine_executeMethod (MediaMachine& machine, int32_t methodIndex) {
1049+ void mediaMachine_executeMethod (MediaMachine& machine, int32_t methodIndex) {
10501050 checkMethodIndex (machine, methodIndex);
10511051 machine->executeMethod (methodIndex);
10521052}
@@ -1078,28 +1078,28 @@ static T& accessOutputByIndex(MemoryPlane<T>& stack, int32_t framePointer, Metho
10781078
10791079// Set input by argument index
10801080// Indexed arguments are confirmed to be inputs during compilation of the script
1081- void machine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, int32_t input) {
1081+ void mediaMachine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, int32_t input) {
10821082 #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
10831083 printText (U" Input " , inputIndex, U" of " , machine->methods [methodIndex].inputCount , U" (" , machine->methods [methodIndex].locals [inputIndex].name , U" ) to " , machine->methods [methodIndex].name , U" = " , input, U" \n " );
10841084 #endif
10851085 checkMethodIndex (machine, methodIndex);
10861086 setInputByIndex (((MediaMemory*)machine->memory .getUnsafe ())->fixedPointMemory , machine->memory ->current .framePointer [DataType_FixedPoint], machine->methods [methodIndex], DataType_FixedPoint, inputIndex, FixedPoint::fromWhole (input));
10871087}
1088- void machine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, const FixedPoint& input) {
1088+ void mediaMachine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, const FixedPoint& input) {
10891089 #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
10901090 printText (U" Input " , inputIndex, U" of " , machine->methods [methodIndex].inputCount , U" (" , machine->methods [methodIndex].locals [inputIndex].name , U" ) to " , machine->methods [methodIndex].name , U" = " , input, U" \n " );
10911091 #endif
10921092 checkMethodIndex (machine, methodIndex);
10931093 setInputByIndex (((MediaMemory*)machine->memory .getUnsafe ())->fixedPointMemory , machine->memory ->current .framePointer [DataType_FixedPoint], machine->methods [methodIndex], DataType_FixedPoint, inputIndex, input);
10941094}
1095- void machine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, const AlignedImageU8& input) {
1095+ void mediaMachine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, const AlignedImageU8& input) {
10961096 #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
10971097 printText (U" Input " , inputIndex, U" of " , machine->methods [methodIndex].inputCount , U" (" , machine->methods [methodIndex].locals [inputIndex].name , U" ) to " , machine->methods [methodIndex].name , U" = monochrome image of " , image_getWidth (input), U" x" , image_getHeight (input), U" pixels\n " );
10981098 #endif
10991099 checkMethodIndex (machine, methodIndex);
11001100 setInputByIndex (((MediaMemory*)machine->memory .getUnsafe ())->alignedImageU8Memory , machine->memory ->current .framePointer [DataType_ImageU8], machine->methods [methodIndex], DataType_ImageU8, inputIndex, input);
11011101}
1102- void machine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, const OrderedImageRgbaU8& input) {
1102+ void mediaMachine_setInputByIndex (MediaMachine& machine, int32_t methodIndex, int32_t inputIndex, const OrderedImageRgbaU8& input) {
11031103 #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
11041104 printText (U" Input " , inputIndex, U" of " , machine->methods [methodIndex].inputCount , U" (" , machine->methods [methodIndex].locals [inputIndex].name , U" ) to " , machine->methods [methodIndex].name , U" = rgba image of " , image_getWidth (input), U" x" , image_getHeight (input), U" pixels\n " );
11051105 #endif
@@ -1108,74 +1108,74 @@ void machine_setInputByIndex(MediaMachine& machine, int32_t methodIndex, int32_t
11081108}
11091109
11101110// Get output by index
1111- FixedPoint machine_getFixedPointOutputByIndex (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
1111+ FixedPoint mediaMachine_getFixedPointOutputByIndex (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
11121112 checkMethodIndex (machine, methodIndex);
11131113 return accessOutputByIndex<FixedPoint>(((MediaMemory*)machine->memory .getUnsafe ())->fixedPointMemory , machine->memory ->current .framePointer [DataType_FixedPoint], machine->methods [methodIndex], DataType_FixedPoint, outputIndex);
11141114}
1115- AlignedImageU8 machine_getImageU8OutputByIndex (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
1115+ AlignedImageU8 mediaMachine_getImageU8OutputByIndex (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
11161116 checkMethodIndex (machine, methodIndex);
11171117 return accessOutputByIndex<AlignedImageU8>(((MediaMemory*)machine->memory .getUnsafe ())->alignedImageU8Memory , machine->memory ->current .framePointer [DataType_ImageU8], machine->methods [methodIndex], DataType_ImageU8, outputIndex);
11181118}
1119- OrderedImageRgbaU8 machine_getImageRgbaU8OutputByIndex (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
1119+ OrderedImageRgbaU8 mediaMachine_getImageRgbaU8OutputByIndex (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
11201120 checkMethodIndex (machine, methodIndex);
11211121 return accessOutputByIndex<OrderedImageRgbaU8>(((MediaMemory*)machine->memory .getUnsafe ())->orderedImageRgbaU8Memory , machine->memory ->current .framePointer [DataType_ImageRgbaU8], machine->methods [methodIndex], DataType_ImageRgbaU8, outputIndex);
11221122}
11231123
1124- bool machine_exists (const MediaMachine& machine) {
1124+ bool mediaMachine_exists (const MediaMachine& machine) {
11251125 return machine.isNotNull ();
11261126}
11271127
1128- int32_t machine_findMethod (const MediaMachine& machine, const ReadableString& methodName) {
1129- if (!machine_exists (machine)) {
1128+ int32_t mediaMachine_findMethod (const MediaMachine& machine, const ReadableString& methodName) {
1129+ if (!mediaMachine_exists (machine)) {
11301130 throwError (U" Can not look for " , methodName, U" in a media machine that does not exist!\n " );
11311131 return -1 ;
11321132 } else {
11331133 return machine->findMethod (methodName);
11341134 }
11351135}
11361136
1137- MediaMethod machine_getMethod (MediaMachine& machine, const ReadableString& methodName, int32_t contextIndex, bool mustExist) {
1138- int32_t methodIndex = machine_findMethod (machine, methodName);
1137+ MediaMethod mediaMachine_getMethod (MediaMachine& machine, const ReadableString& methodName, int32_t contextIndex, bool mustExist) {
1138+ int32_t methodIndex = mediaMachine_findMethod (machine, methodName);
11391139 if (mustExist && methodIndex == -1 ) {
11401140 throwError (U" The method name " , methodName, U" could not be found in the media machine!\n " );
11411141 }
11421142 return MediaMethod (machine, methodIndex, contextIndex);
11431143}
11441144
1145- String machine_getMethodName (const MediaMachine& machine, int32_t methodIndex) {
1145+ String mediaMachine_getMethodName (const MediaMachine& machine, int32_t methodIndex) {
11461146 checkMethodIndex (machine, methodIndex);
11471147 return machine->methods [methodIndex].name ;
11481148}
11491149
1150- int32_t machine_getMethodCount (const MediaMachine& machine) {
1150+ int32_t mediaMachine_getMethodCount (const MediaMachine& machine) {
11511151 checkMachine (machine);
11521152 return machine->methods .length ();
11531153}
11541154
1155- int32_t machine_getInputCount (const MediaMachine& machine, int32_t methodIndex) {
1155+ int32_t mediaMachine_getInputCount (const MediaMachine& machine, int32_t methodIndex) {
11561156 checkMethodIndex (machine, methodIndex);
11571157 return machine->methods [methodIndex].inputCount ;
11581158}
11591159
1160- int32_t machine_getOutputCount (const MediaMachine& machine, int32_t methodIndex) {
1160+ int32_t mediaMachine_getOutputCount (const MediaMachine& machine, int32_t methodIndex) {
11611161 checkMethodIndex (machine, methodIndex);
11621162 return machine->methods [methodIndex].outputCount ;
11631163}
11641164
1165- String machine_getInputName (const MediaMachine& machine, int32_t methodIndex, int32_t inputIndex) {
1165+ String mediaMachine_getInputName (const MediaMachine& machine, int32_t methodIndex, int32_t inputIndex) {
11661166 checkMethodIndex (machine, methodIndex);
11671167 Method<MEDIA_MACHINE_TYPE_COUNT> *method = &(machine->methods [methodIndex]);
11681168 if (inputIndex < 0 || inputIndex >= method->inputCount ) {
1169- throwError (U" Input index " , inputIndex, U" is out of bound 0.." , method->inputCount - 1 , U" for method " , machine_getMethodName (machine, methodIndex), U" !\n " );
1169+ throwError (U" Input index " , inputIndex, U" is out of bound 0.." , method->inputCount - 1 , U" for method " , mediaMachine_getMethodName (machine, methodIndex), U" !\n " );
11701170 }
11711171 return method->locals [inputIndex].name ;
11721172}
11731173
1174- String machine_getOutputName (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
1174+ String mediaMachine_getOutputName (const MediaMachine& machine, int32_t methodIndex, int32_t outputIndex) {
11751175 checkMethodIndex (machine, methodIndex);
11761176 Method<MEDIA_MACHINE_TYPE_COUNT> *method = &(machine->methods [methodIndex]);
11771177 if (outputIndex < 0 || outputIndex >= method->outputCount ) {
1178- throwError (U" Input index " , outputIndex, U" is out of bound 0.." , method->outputCount - 1 , U" for method " , machine_getMethodName (machine, methodIndex), U" !\n " );
1178+ throwError (U" Input index " , outputIndex, U" is out of bound 0.." , method->outputCount - 1 , U" for method " , mediaMachine_getMethodName (machine, methodIndex), U" !\n " );
11791179 }
11801180 return method->locals [method->inputCount + outputIndex].name ;
11811181}
@@ -1190,7 +1190,7 @@ MediaResult MediaMethod::callUsingKeywords(const TemporaryCallback<void(MediaMac
11901190 for (int32_t i = 0 ; i < inputCount; i++) {
11911191 setInputAction (this ->machine , this ->methodIndex , i, method->locals [i].name );
11921192 }
1193- machine_executeMethod (this ->machine , this ->methodIndex );
1193+ mediaMachine_executeMethod (this ->machine , this ->methodIndex );
11941194 return MediaResult (this ->machine , this ->methodIndex );
11951195}
11961196
0 commit comments