J_Misc.c
J_Object createJavaStringObjectFromUtfString(J_UtfString s){
  J_Object obj, charArrayObj;
  uint16_t* charStart;
  uint32_t  i;
  J_Class*  sClass;
  J_Error_t e;
	
 /* create and fill char array */
  charArrayObj = createArray(5,s.len); /* type "C" - chars */
  if(!charArrayObj) return 0;

 /* push object on extended stack for avoid GC */
  jExtPushObj(charArrayObj);
 
  charStart = (uint16_t*) J_ARRAY_START(charArrayObj);
  for(i=0;i<s.len;i++)
	charStart[i] = (uint16_t) s.str[i];

 /* create String object and set char array */
  if((e=jGetClass(&sClass,jUtfCreate("java/lang/String"),NULL))!=EOK)
	err(ERR_FATAL,"Can't load class 'java/lang/String' : %d",e);
 
  obj = allocateObject(sClass,1);

  if(obj!=0){
	J_STRING_ARRAY_OBJ(obj) = charArrayObj;
   /* experimental */
	J_ARRAY_LEN(charArrayObj) = s.len;
  }

 /* pop object from extended stack */
  jExtPopObj();
  
  return obj;
}
/**
 * Create java/lang/String class object from utf string
 */
Create java/lang/String class object from utf string
Create java / lang / String class object from utf string
J_Object createJavaStringObjectFromUtfString(J_UtfString s){
  J_Object obj, charArrayObj;
  uint16_t* charStart;
  uint32_t  i;
  J_Class*  sClass;
  J_Error_t e;
  charArrayObj = createArray(5,s.len); 
  if(!charArrayObj) return 0;
  jExtPushObj(charArrayObj);
  charStart = (uint16_t*) J_ARRAY_START(charArrayObj);
  for(i=0;i<s.len;i++)
	charStart[i] = (uint16_t) s.str[i];
  if((e=jGetClass(&sClass,jUtfCreate("java/lang/String"),NULL))!=EOK)
	err(ERR_FATAL,"Can't load class 'java/lang/String' : %d",e);
  obj = allocateObject(sClass,1);
  if(obj!=0){
	J_STRING_ARRAY_OBJ(obj) = charArrayObj;
	J_ARRAY_LEN(charArrayObj) = s.len;
  }
  jExtPopObj();
  return obj;
}
J_Object createJavaStringObjectFromUtfString ( J_UtfString s ) { J_Object obj , charArrayObj ; uint16_t * charStart ; uint32_t i ; J_Class * sClass ; J_Error_t e ; charArrayObj = createArray ( 5 , s . len ) ; if ( ! charArrayObj ) return 0 ; jExtPushObj ( charArrayObj ) ; charStart = ( uint16_t * ) J_ARRAY_START ( charArrayObj ) ; for ( i = 0 ; i < s . len ; i ++ ) charStart [ i ] = ( uint16_t ) s . str [ i ] ; if ( ( e = jGetClass ( & sClass , jUtfCreate ( " " ) , NULL ) ) != EOK ) err ( ERR_FATAL , " " , e ) ; obj = allocateObject ( sClass , 1 ) ; if ( obj != 0 ) { J_STRING_ARRAY_OBJ ( obj ) = charArrayObj ; J_ARRAY_LEN ( charArrayObj ) = s . len ; } jExtPopObj ( ) ; return obj ; }
Create java/lang/String class object from utf string
Create java / lang / String class object from utf string
/* create and fill char array */ /* type "C" - chars */ /* push object on extended stack for avoid GC */ /* create String object and set char array */ /* experimental */ /* pop object from extended stack */