Pages

Wednesday, October 31, 2012

Polymorphism

In construction …

Inheritance

In construction …

Tuesday, October 30, 2012

The Language Toolkit read

http://www.eclipse.org/articles/Article-LTK/ltk.html A subclass of org.eclipse.ltk.core.refactoring.Refactoring must always be created. As is in this quotation, we need to extend Refactoring. Screen Shot 2012 10 30 at 11 27 24 PM As a result of extending Refactoring class, you need to implement four method. Screen Shot 2012 10 30 at 11 28 39 PM

LKT usage hint of eclipse from Use, Disuse, and Misues of Automated Refactorings paper.

Use, Disuse, and Misuse of Automated Refactorings paper has some clues on how to execute the eclipse refactoring in a programmatic way.
  1. It knows the selected string - "selection-text"
  2. The method that contains the selection - "code-snippet"
  3. Source code - "input"
  4. The kind of refactoring (maybe from the menu) - "id"
Screen Shot 2012 10 30 at 10 51 29 PM

simple make example

  • You can use variable by assigning it, and use it with $(), it can be anything, you can even think of it as a macro.
  • You can use $@ to replace the target. @ is a good name to represent the goal(target).
  • $+ means all prerequisites with space separated when multiple is given.
  • %.o:%.c shows the relationship based on extension name. Don't forget it uses % not *.
# 1
# Defining the compiler:
CC=gcc

# Defining the object files:
objects = main.o example.o

# 2
# The default rule - compiling our main program:
all:	sample
		echo all: make complete

# 3
sample: $(objects)
	# If we get here, all the dependencies are now built.
	# Link it:
	$(CC) -o $@ $+

# 4
# Tell make how to build .o files from .c files:
%.o:%.c
	$(CC) -c $+
	
# 5
#Now make sure that make rebuilds files if included headers change:
main.o: main.h defs.h
example.o: example.h defs.h
http://linuxdevcenter.com/pub/a/linux/2002/01/31/make_intro.html?page=2

phony target in make

When you execute make clean, you are using phony target. phony target is a target that doesn't have the dependencies, but only the actions.
# Naming our phony targets
.PHONY: clean install

# Removing the executable and the object files
clean: 
		rm sample main.o example.o
		echo clean: make complete

# Installing the final product
install:
		cp sample /usr/local
		echo install: make complete

How JPF finds the files

site.properties

~/.jpf/site.properties file is the one where all the directory information is located.
# JPF site configuration
user.home = /Users/smcho/
jpf.home = ${user.home}/Dropbox/smcho/workspace/jpf

# can only expand system properties
jpf-core = ${jpf.home}/jpf-core

jpf-symbc = ${jpf.home}/jpf-symbc
extensions+=,${jpf-symbc}

jpf-guided-test = ${jpf.home}/jpf-guided-test
extensions+=,${jpf-guided-test}

jpf-regression = ${jpf.home}/jpf-regression
extensions+=,${jpf-regression}

jpf-porting = ${jpf.home}/jpf-porting
extensions+=,${jpf-porting}
It points to where all the jpf related information are located.

jpf.properties

Now, you can set up your jpf.properties so that you can point to where ever you want.
#--- project specific host VM classpath (used by Java to load classes)
# NOTE: you have to replace the wildcard jar specs with explicit jar pathnames
# if this property file is used from within a build.xml or NetBeans project.xml,
# since both do not support wildcard patterns in classpath specs
jpf-porting.native_classpath =\
   ${jpf-porting}/build/jpf-porting.jar;\
   ${jpf-porting}/lib/*.jar;\
   ${jpf-symbc}/lib/commons-lang-2.4.jar;
   

#--- project specific JPF classpath (used by JPF to load system-under-test classes)
jpf-porting.classpath =\
   ${jpf-porting}/build/examples;

#--- where are the classes for the JPF regression tests (used by host VM and JPF)
jpf-porting.test_classpath =\
   ${jpf-porting}/build/tests
   
#--- project specific JPF sourcepath (used by JPF to locate sources for system-under-test classes)
jpf-porting.sourcepath =\
   ${jpf-porting}/src

#--- other project specific options go here (e.g. 'vm.insn_factory.class' or 'peer_packages')
peer_packages= gov.nasa.jpf.symbc,${peer_packages}
vm.storage.class=nil
search.multiple_errors=true
symbolic.dp=choco

From RunJPF.jar you can specify the file path of properties file.
java -jar /Users/smcho/Dropbox/smcho/workspace/jpf/jpf-core/build/RunJPF.jar \
+shell.port=4242 \
/Users/smcho/Dropbox/smcho/works/tasks/2012/seal/refactoringChecker/tests/case_ini_is_generated_from_ref_finder/TestA/A.jpf -v\
-c jpf.properties
Now, you can modify the properties file to point to the example directory.