1 package com.tapina.robe.swi.clib.string; 2 3 import com.tapina.robe.runtime.Environment; 4 import com.tapina.robe.runtime.MemoryMap; 5 import com.tapina.robe.swi.clib.Stub; 6 7 /*** 8 * This function compares up to a3 characters and returns a value as appropriate. Characters after a null byte are not 9 * compared. 10 * Returns: Greater than, less than or equal to zero, depending if the string pointed to by a1 is greater than, 11 * less than or equal to the string pointed to by a2. 12 */ 13 public class StrNCmp extends Stub { 14 public void executeStub(Environment environment) { 15 final MemoryMap memoryMap = environment.getMemoryMap(); 16 final int[] R = environment.getCpu().R; 17 final String str1 = memoryMap.getStringN(R[0], R[2]); 18 final String str2 = memoryMap.getStringN(R[1], R[2]); 19 R[0] = str1.compareTo(str2); 20 } 21 }