Hi,
I would like to retrieve the number of lines of code of a file when importing C code in moose. Here is what I do once the code loaded in moose:
- I inspect a FAMIXFile from the MooseFinder -> when printing 'self numberOfLinesOfText' , it returns '0' (while the corresponding file is not empty). This is my first problem, - Then, I try to retrieve the object CAImplementation (from CAnalyzer) correspondind by inspecting 'self entities first' (is it the good way?) -> when printing 'self numberOfLinesOfText', it returns '-1' (-> even if I inspect directly a CAImplementation object from the moose finder, it returns -1)
So is there somethings wrong or is the problem coming from the xml files generated bu srcml?
On 6 janv. 2010, at 16:19, Cyrille Delaunay wrote:
Hi,
I would like to retrieve the number of lines of code of a file when importing C code in moose. Here is what I do once the code loaded in moose:
Isn't there a numberOfLinesOfCode on CAImplementation?
And it's easy to define a redirection from FamixFile to CAImplementation (there is a 1-1 relationship)
- I inspect a FAMIXFile from the MooseFinder -> when printing 'self numberOfLinesOfText' , it returns '0' (while the corresponding file is not empty). This is my first problem,
- Then, I try to retrieve the object CAImplementation (from CAnalyzer) correspondind by inspecting 'self entities first' (is it the good way?) -> when printing 'self numberOfLinesOfText', it returns '-1' (-> even if I inspect directly a CAImplementation object from the moose finder, it returns -1)
So is there somethings wrong or is the problem coming from the xml files generated bu srcml?
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
2010/1/6 Simon Denier Simon.Denier@inria.fr
On 6 janv. 2010, at 16:19, Cyrille Delaunay wrote:
Hi,
I would like to retrieve the number of lines of code of a file when
importing C code in moose. Here is what I do once the code loaded in moose:
Isn't there a numberOfLinesOfCode on CAImplementation?
And it's easy to define a redirection from FamixFile to CAImplementation (there is a 1-1 relationship)
Yes, it is what I do , but it doesn't return me what I expect (see below, the end of the mail)
- I inspect a FAMIXFile from the MooseFinder -> when printing 'self numberOfLinesOfText' , it returns '0'
(while the corresponding file is not empty). This is my first problem,
- Then, I try to retrieve the object CAImplementation (from CAnalyzer)
correspondind by inspecting 'self entities first' (is it the good way?)
-> when printing 'self numberOfLinesOfText', it returns '-1' (-> even if I inspect directly a CAImplementation object from the
moose finder, it returns -1)
So is there somethings wrong or is the problem coming from the xml files
generated bu srcml?
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
On 6 janv. 2010, at 16:48, Cyrille Delaunay wrote:
2010/1/6 Simon Denier Simon.Denier@inria.fr
On 6 janv. 2010, at 16:19, Cyrille Delaunay wrote:
Hi,
I would like to retrieve the number of lines of code of a file when importing C code in moose. Here is what I do once the code loaded in moose:
Isn't there a numberOfLinesOfCode on CAImplementation?
And it's easy to define a redirection from FamixFile to CAImplementation (there is a 1-1 relationship)
Yes, it is what I do , but it doesn't return me what I expect (see below, the end of the mail)
I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
- I inspect a FAMIXFile from the MooseFinder -> when printing 'self numberOfLinesOfText' , it returns '0' (while the corresponding file is not empty). This is my first problem,
- Then, I try to retrieve the object CAImplementation (from CAnalyzer) correspondind by inspecting 'self entities first' (is it the good way?) -> when printing 'self numberOfLinesOfText', it returns '-1' (-> even if I inspect directly a CAImplementation object from the moose finder, it returns -1)
So is there somethings wrong or is the problem coming from the xml files generated bu srcml?
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
2010/1/6 Simon Denier Simon.Denier@inria.fr
On 6 janv. 2010, at 16:48, Cyrille Delaunay wrote:
2010/1/6 Simon Denier Simon.Denier@inria.fr
On 6 janv. 2010, at 16:19, Cyrille Delaunay wrote:
Hi,
I would like to retrieve the number of lines of code of a file when
importing C code in moose. Here is what I do once the code loaded in moose:
Isn't there a numberOfLinesOfCode on CAImplementation?
And it's easy to define a redirection from FamixFile to CAImplementation (there is a 1-1 relationship)
Yes, it is what I do , but it doesn't return me what I expect (see below, the end of the mail)
I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
I used the old ones about Linux kernel . I retrieved it from lse svn
- I inspect a FAMIXFile from the MooseFinder -> when printing 'self numberOfLinesOfText' , it returns '0'
(while the corresponding file is not empty). This is my first problem,
- Then, I try to retrieve the object CAImplementation (from CAnalyzer)
correspondind by inspecting 'self entities first' (is it the good way?)
-> when printing 'self numberOfLinesOfText', it returns '-1' (-> even if I inspect directly a CAImplementation object from the
moose finder, it returns -1)
So is there somethings wrong or is the problem coming from the xml files
generated bu srcml?
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
No, you do not need the original source code for computing the lines of code. There is a bijection between srcML XML files and original source code. This is a great strenght of srcML.
Cyrille, did you solve the problem?
Cheers, Alexandre
No, the problem is still present. The xml file corresponding to the file for which I want to retrieve the information seems to be well-formed. So, it is maybe a problem from CAnalyzer.
2010/1/6 Alexandre Bergel alexandre@bergel.eu
I didnt check, but I think that CAnalyzer needs to access the source and
xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
No, you do not need the original source code for computing the lines of code. There is a bijection between srcML XML files and original source code. This is a great strenght of srcML.
Cyrille, did you solve the problem?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Ok, I will provide a solution soon.
Alexandre
On 7 Jan 2010, at 09:23, Cyrille Delaunay wrote:
No, the problem is still present. The xml file corresponding to the file for which I want to retrieve the information seems to be well- formed. So, it is maybe a problem from CAnalyzer.
2010/1/6 Alexandre Bergel alexandre@bergel.eu I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
No, you do not need the original source code for computing the lines of code. There is a bijection between srcML XML files and original source code. This is a great strenght of srcML.
Cyrille, did you solve the problem?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Hi Cyrille,
I cannot reproduce the problem. I added a new method FAMIXFile>>numberOfLinesOfCode as an extension of CAnalyzer. The following test goes green: -=-=-=-=-=-=-=-=-=-=-=-= testSourceCode2 | filename1 importer | filename1 := 'file1.c.xml'. self removeFileIfPresent: filename1. self createFile: filename1 with: self sourceFile1XML.
mooseModel := MooseModel new. importer := CXMLFileImporter inModel: mooseModel. importer loadXMLFilesNamed: {filename1}.
self assert: (mooseModel entityNamed: 'file1.cunit::foo()') numberOfLinesOfCode = 2. self assert: (mooseModel entityNamed: 'file1.cunit::main()') numberOfLinesOfCode = 6.
self assert: ((mooseModel entityNamed: #'file1.c') numberOfLinesOfCode = 19). self assert: ((mooseModel entityNamed: 'file1.cunit') numberOfLinesOfCode = 19). -=-=-=-=-=-=-=-=-=-=-=-=
The two last lines are probably the most interesting for you.
Cheers, Alexandre
On 7 Jan 2010, at 09:23, Cyrille Delaunay wrote:
No, the problem is still present. The xml file corresponding to the file for which I want to retrieve the information seems to be well- formed. So, it is maybe a problem from CAnalyzer.
2010/1/6 Alexandre Bergel alexandre@bergel.eu I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
No, you do not need the original source code for computing the lines of code. There is a bijection between srcML XML files and original source code. This is a great strenght of srcML.
Cyrille, did you solve the problem?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Yes, now I have retest in a new image and reloading the C code in moose and it works. Maybe the problem was due to a 'bad importation' of the C code. Thanks a lot alex.
2010/1/7 Alexandre Bergel alexandre@bergel.eu
Hi Cyrille,
I cannot reproduce the problem. I added a new method FAMIXFile>>numberOfLinesOfCode as an extension of CAnalyzer. The following test goes green: -=-=-=-=-=-=-=-=-=-=-=-= testSourceCode2 | filename1 importer | filename1 := 'file1.c.xml'. self removeFileIfPresent: filename1. self createFile: filename1 with: self sourceFile1XML.
mooseModel := MooseModel new. importer := CXMLFileImporter inModel: mooseModel. importer loadXMLFilesNamed: {filename1}. self assert: (mooseModel entityNamed: 'file1.cunit::foo()')
numberOfLinesOfCode = 2. self assert: (mooseModel entityNamed: 'file1.cunit::main()') numberOfLinesOfCode = 6.
self assert: ((mooseModel entityNamed: #'file1.c')
numberOfLinesOfCode = 19). self assert: ((mooseModel entityNamed: 'file1.cunit') numberOfLinesOfCode = 19). -=-=-=-=-=-=-=-=-=-=-=-=
The two last lines are probably the most interesting for you.
Cheers,
Alexandre
On 7 Jan 2010, at 09:23, Cyrille Delaunay wrote:
No, the problem is still present. The xml file corresponding to the file
for which I want to retrieve the information seems to be well-formed. So, it is maybe a problem from CAnalyzer.
2010/1/6 Alexandre Bergel alexandre@bergel.eu I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
No, you do not need the original source code for computing the lines of code. There is a bijection between srcML XML files and original source code. This is a great strenght of srcML.
Cyrille, did you solve the problem?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Yes, now I have retest in a new image and reloading the C code in moose and it works. Maybe the problem was due to a 'bad importation' of the C code. Thanks a lot alex.
No problem. Let me know how it goes.
Alexandre
2010/1/7 Alexandre Bergel alexandre@bergel.eu Hi Cyrille,
I cannot reproduce the problem. I added a new method FAMIXFile>>numberOfLinesOfCode as an extension of CAnalyzer. The following test goes green: -=-=-=-=-=-=-=-=-=-=-=-= testSourceCode2 | filename1 importer | filename1 := 'file1.c.xml'. self removeFileIfPresent: filename1. self createFile: filename1 with: self sourceFile1XML.
mooseModel := MooseModel new. importer := CXMLFileImporter inModel: mooseModel. importer loadXMLFilesNamed: {filename1}. self assert: (mooseModel entityNamed: 'file1.cunit::foo()')
numberOfLinesOfCode = 2. self assert: (mooseModel entityNamed: 'file1.cunit::main()') numberOfLinesOfCode = 6.
self assert: ((mooseModel entityNamed: #'file1.c')
numberOfLinesOfCode = 19). self assert: ((mooseModel entityNamed: 'file1.cunit') numberOfLinesOfCode = 19). -=-=-=-=-=-=-=-=-=-=-=-=
The two last lines are probably the most interesting for you.
Cheers,
Alexandre
On 7 Jan 2010, at 09:23, Cyrille Delaunay wrote:
No, the problem is still present. The xml file corresponding to the file for which I want to retrieve the information seems to be well- formed. So, it is maybe a problem from CAnalyzer.
2010/1/6 Alexandre Bergel alexandre@bergel.eu I didnt check, but I think that CAnalyzer needs to access the source and xml files to compute lines of code. How did you import your model? Where is it on disk? Did you generate new xml files or use old ones?
No, you do not need the original source code for computing the lines of code. There is a bijection between srcML XML files and original source code. This is a great strenght of srcML.
Cyrille, did you solve the problem?
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev