MozillaZine

What language is Firefox written in - Revisted...

Discussion about official Mozilla Firefox builds
Dr. Joe

User avatar
 
Posts: 24
Joined: October 4th, 2005, 9:13 pm
Location: Coming and going

Post Posted June 26th, 2008, 12:04 pm

Hello all,

Just about a year ago I posted the post below and would like to find out if anything has changed since then. From my take most folks said that C++ was the code used to build Firefox along with Javascript and a few other languages for front end use. If that's still the case, any certain type of C++ used (visual, .NET, compilers used, etc)?

I haven't programmed in many many years and am thinking about getting back into the groove of things (once again) and would like to create some hobby applications that look and feel similar to the Firefox experience - especially with the tabbing features. After all, why reinvent the wheel...


Best regards,
dj




Original post about a year ago.....

I know it's a silly question, but I'm curious about which language(s) Firefox is written in. Also, are multiple languages used then compiled down into one happy family for cross-platform compatibility? (Gees, I'm getting technical here with my buzzwords, haha.)

Racer
 
Posts: 6108
Joined: November 18th, 2002, 11:07 am

Post Posted June 26th, 2008, 12:11 pm

Most code is straight C++, with Javascript doing some of the front end work. The Windows compiler is VS .NET, but it is not "managed".

If you are looking to write a simple UI application based on the Firefox core, then you might want to take a look at XULRunner.

steviex
Moderator

User avatar
 
Posts: 28902
Joined: August 12th, 2006, 8:27 am
Location: Middle England

Post Posted June 26th, 2008, 12:17 pm

The best place to start your reading is HERE...... http://developer.mozilla.org/en/docs/Bu ... umentation
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. -Albert Einstein

Please DO NOT PM me for support... Lets keep it on the board, so we can all learn.

Omega X

User avatar
 
Posts: 7345
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Post Posted June 26th, 2008, 5:56 pm

Racer wrote:Most code is straight C++, with Javascript doing some of the front end work. The Windows compiler is VS .NET, but it is not "managed".

If you are looking to write a simple UI application based on the Firefox core, then you might want to take a look at XULRunner.


Frontend is XUL, Javascript and CSS.
Latest: Firefox/38.0.1 *ESR/38.0.1 - Mobile/38.0.1 - Thunderbird/31.7.0 - SeaMonkey/2.33.1
Nightly: Nightly/41.0 - Mobile/41.0 - Daily/41.0 - SeaMonkey/2.35a1

skellr

User avatar
 
Posts: 39
Joined: June 17th, 2005, 6:25 pm
Location: init 1

Post Posted June 27th, 2008, 12:00 am

This is what SLOCCount comes up with. There are a few more languages used than it checks for but it's interesting anyway.
Code: Select all
SLOC   Directory   SLOC-by-Language (Sorted)
475771  security        ansic=401988,cpp=30126,asm=28313,sh=12534,perl=2362,
                        lex=306,yacc=79,ada=49,csh=10,sed=4
214917  layout          cpp=213968,perl=698,sh=251
183493  gfx             cpp=92188,ansic=91121,perl=174,awk=10
173573  content         cpp=173480,perl=89,sh=4
155271  js              cpp=124352,ansic=17060,java=8272,perl=4743,sh=798,
                        asm=46
154141  modules         cpp=87316,ansic=65694,java=598,perl=533
126706  nsprpub         ansic=122078,cpp=2834,asm=1002,sh=668,perl=124
119422  xpcom           cpp=97100,ansic=17425,asm=4625,perl=200,python=72
88979   db              ansic=53626,cpp=35339,python=14
84966   toolkit         cpp=69434,sh=10078,ansic=2229,objc=1476,perl=893,
                        python=458,php=244,java=97,asm=57
83016   embedding       cpp=78239,ansic=3803,cs=453,perl=375,pascal=86,java=49,
                        sh=11
68146   netwerk         cpp=63008,ansic=4616,java=354,perl=96,python=66,sh=6
65828   widget          cpp=59500,ansic=6328
60347   extensions      cpp=47869,ansic=5237,python=3981,java=2841,lisp=256,
                        perl=96,sh=67
57332   intl            cpp=37049,ansic=16067,perl=4192,sh=24
53616   editor          cpp=53616
36027   tools           ansic=15271,cpp=8002,perl=7997,python=2698,sh=1159,
                        pascal=813,awk=59,csh=28
32905   accessible      cpp=32905
31373   dom             cpp=31373
30051   parser          cpp=18100,ansic=11774,perl=177
27095   xpfe            cpp=26578,ansic=517
19189   other-licenses  cpp=16654,ansic=2534,sh=1
18499   plugin          cpp=17385,java=1114
17662   jpeg            ansic=17378,asm=284
14913   rdf             cpp=14913
12980   config          ansic=7425,perl=2686,python=1976,cpp=783,sh=110
12307   uriloader       cpp=12307
12152   docshell        cpp=12152
10982   browser         cpp=10723,perl=119,sh=117,python=23
9805    build           sh=3660,perl=2399,cpp=2396,ansic=1274,python=76
9083    testing         python=4405,sh=2532,perl=1839,cpp=292,exp=12,sed=3
7920    ipc             cpp=7920
5426    caps            cpp=5426
5344    memory          ansic=5303,perl=36,python=5
4389    dbm             ansic=4389
3486    view            cpp=3486
3450    sun-java        ansic=1756,cpp=1694
3354    xpinstall       cpp=2708,perl=646
2980    storage         cpp=2980
2883    profile         cpp=2883
2674    chrome          cpp=2674
1247    xulrunner       cpp=1027,sh=220
114     top_dir         python=79,sh=35
60      webshell        cpp=60
0       probes          (none)


Totals grouped by language (dominant language first):
cpp:        1500839 (59.94%)
ansic:       874893 (34.94%)
asm:          34327 (1.37%)
sh:           32275 (1.29%)
perl:         30474 (1.22%)
python:       13853 (0.55%)
java:         13325 (0.53%)
objc:          1476 (0.06%)
pascal:         899 (0.04%)
cs:             453 (0.02%)
lex:            306 (0.01%)
lisp:           256 (0.01%)
php:            244 (0.01%)
yacc:            79 (0.00%)
awk:             69 (0.00%)
ada:             49 (0.00%)
csh:             38 (0.00%)
exp:             12 (0.00%)
sed:              7 (0.00%)




Total Physical Source Lines of Code (SLOC)                = 2,503,874
Development Effort Estimate, Person-Years (Person-Months) = 740.58 (8,886.98)
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months)                         = 6.60 (79.15)
 (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)  = 112.28
Total Estimated Cost to Develop                           = $ 100,042,542
 (average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."

kliu0x52

User avatar
 
Posts: 569
Joined: October 18th, 2006, 2:23 pm
Location: .us

Post Posted June 27th, 2008, 4:16 am

Rainskellar wrote:There are a few more languages used than it checks for but it's interesting anyway.

Like, um, JavaScript? This basically ignores much of the front-end. ;) Core is generally C++ (most parts) and C (JavaScript engine, cairo, and sqlite are the biggies, though the latter two are not in-house). There's build/testing and other miscellany that can get counted, and that'd explain the perl, python, etc.

It's important to remember that Gecko is meant to be a platform on which other code can be run. So there are really two products here: Gecko, and the application (Firefox, Thunderbird, Flock, etc.) that runs atop Gecko.
My addons: NoRedirect | QuickDrag | URL Flipper | TabSubmit
Developers: Make sure to test your addons for RTL compatibility!

skellr

User avatar
 
Posts: 39
Joined: June 17th, 2005, 6:25 pm
Location: init 1

Post Posted June 27th, 2008, 5:48 am

It turns out that the Ada in security/ isn't really Ada but a shell script with an .adb extension. :(

Ted Mielczarek
 
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA

Post Posted June 27th, 2008, 7:48 am

Yeah, I was wondering when we got Ada and Pascal in the mix. But indeed, if this doesn't count .js, .xul, .xml, it's missing a huge portion of the GUI.

skellr

User avatar
 
Posts: 39
Joined: June 17th, 2005, 6:25 pm
Location: init 1

Post Posted June 27th, 2008, 9:38 am

Found a nice Perl script named cloc. It allows custom definitions for languages not included by default so I added XUL and RDF. It's starting to shape up now. :) Sorry about the image but it was borderline unreadable in the forum code formating.

Image
omploader ftw. :)
http://server6.theimagehosting.com/imag ... 7-cloc.png

Dr. Joe

User avatar
 
Posts: 24
Joined: October 4th, 2005, 9:13 pm
Location: Coming and going

Post Posted June 27th, 2008, 10:36 am

Thanks for the replies everyone. So it looks like C++ is the major language used.

Very nice information from cloc also.

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 10 guests