
sii preprosessor

 
sii, objective-sii, sii + +, vividha fortran bhashakal thudangi niravadhi computer prograaming bhashakalkkulla macro preprosessoraanu sii preprosessor. preprosessor header fayalukal, macro vipuleekaranangal, vyavasthaapitha samahaaram, line niyanthranam enniva ulppeduthunnu.
pala sii nadappaakkalukalilum, vivarthanathinte aadya bhaagamaayi compiler ahvaanam cheiyunna oru prathyeka prograamaanith.
preprosessor nirddeshangalude bhasha sii yude vyakaranavumaayi durbalamaayi bandhappettirikkunnu, athinaal chilappol mattu tharatthilulla tekst fayalukal prosess cheyyaan ithu upayogikkunnu.
charithram.
1973-ll alaan sniderude nirddeshaprakaaravum bcplilum pl/aiyilum labhyamaya phayal ulppeduthal samvidaanangalude upayogakshamatha amgeekarikkunnathaayum preprosessor sii-yill avatharippichu. athinte yadhaartha pathipp yathaakramam parameterless maakrokalkkaayi cockways _ 1, cockways _ 2 enniva upayogichu phayal ulppeduthalum lalithamaaya string maattisthaapikkalum maathrame vaagdaanam cheythirunnulloo. taamasiyaathe, aadyam mike lesk pinneedu joonn raiser, vaadangalum vyavasthaapitha samahaaravum upayogichu maakrokal ulppeduthunnathinaayi ithu vipuleekarichu.
1959ll dougless eastwood dougless misilroyum chernnu aarambhicha bell laabukalile oru neenda macro-bhasha paarambaryatthinte bhaagamaayirunnu sii preprosessor.
gattangal.
sii staanderdil vyakthamakkiya "vivarthanathinte ettu ghattangalil" aadya naalu gattangalaanu preprosessingine nirvachikkunnath.
fayalukal ulppede.
preprosessorinte ettavum saadhaaranamaaya upayogangalilonnu mattoru sozhs phayal ulppeduthuka ennathaanu
int maine (shoonyam)
 printef ("haloo, lokam!\enn);
 0 thirike nalkuka;
preprosessor 'stadiyo' fayalinte tekst ulladakkam upayogichu kokvu _ 4 line pakaram vaykkunnu.echu ', ithu mattu karyangalkkoppam kokwos _ 5 function prakhyaapikkunnu.
eratta udharanikal upayogichum ithu ezhuthaam, udha.jii. kokway _ 6. fayalinte peru angle brackettinullil ulppeduthiyittundel, staanderd compileril phayal thirayunnu. fayalinte peru eratta udharanikalkkullil ulppeduthiyittundel, nilavile uravida phayal directory ulppeduthunnathinaayi thirayal paatha vipuleekarikkunnu. sii compilerukalkkum prograaming parithasthithikalkkum evide ulppeduthiyittulla fayalukal kandethaamenn nirvachikkaan prograamare anuvadikkunna oru soukaryamundu. udaaharanathinu, vyathyastha operating systengalkkaayi mattoru koottam inkul fayalukal maattiyedukkaan kazhiyunna tharatthil oru command-line flaagiloode ithu avatharippikkan kazhiyum, ithu oru makefile upayogichu paaraameettar cheyyaan kazhiyum.
kanvenshan anusarichu, ulppeduthuka fayalukalkku 'eiii' ennu perunalkunnu.echu "allengil".echu. pii. pii "ekstenshan. ennirunnaalum, ithu nireekshikkenda aavasyamilla. ennathilulla fayalukal.def "ekstenshan onniladhikam thavana ulppeduthaan roopakalppana cheytha fayalukale soochippikkaam, oro thavanayum ore aavarthana ulladakkam vipuleekarikkumbol; kokvi _ 7 oru exbm imej fayaline soochippikkaan saadhyathayund (ithu ore samayam oru sii sozhs fayalaanu).
eratta ulppeduthal thadayunnathinu kookk 1 gaardukal allengil kookk 10 upayogikkaan kookk 1 palappozhum nirbandhikkunnu.
vyavasthaapitha samahaaram.
cocks _ 11, cocks _ 12, cocks _ 13, cocks _ 14, cocks _ 15, cocks _ 16 ennee nirddeshangal vyavasthaapitha samaahaarathinaayi upayogikkaam. avaa aandu ennathinu lalithamaaya hraswavaakyangalaanu.
 print eph ("trace sandesham");
microsopht windos targettucheyyunna mikka compilerukalum cockways _ 17-neey parokshamaayi nirvachikkunnu. ithu preprosessor commandukal ulppedeyulla kodine windos sisttangale taargettucheyyumbol maathram compile cheyyaan anuvadikkunnu. pakaram chila compilerukal cocks _ 18 nirvachikkunnu. kokwos _ 17 macro avyakthamaayi nirvachikkaattha atharam compilerukalkku, kokwos _ 20 upayogichu compilerinte command lainil ithu vyakthamaakkam.
oru macro cocks _ 21 nirvachichittundo ennu udaaharana coode parishodhikkunnu. anganeyaanengil, kokwos _ 22 enna phayal pinneedu ulppeduthum. allaathapaksham, pakaram oru macro cocks _ 17 nirvachichittundo ennu ithu parishodhikkunnu. anganeyaanengil, kokvi _ 24 enna phayal pinneedu ulppeduthum.
kooduthal sankeernamaaya oru cockways _ 11 udaaharanathinu oopparettarmaare upayogikkaam, udaaharanathina
 //njangal oru 32-bitt systethinaayi samaaharikkukayaan.
 //njangal oru 64-bitt systethinaayi samaaharikkukayaan.
cockways _ 26 nirddesham upayogichum vivarthanam parajayappedaam
macro nirvachanavum vipuleekaranavum.
object-like", "function-like" enningane rund tharam maakrokalund. object polulla maakrokal paaraamettarukal edukkunnilla; function polulla maakrokal cheiyunnu (paaraamettarukalude pattika shoonyamaayirikkaamenkilum). oro tharatthilumulla oru macro aayi oru identifierine prakhyaapikkunnathinulla pothuvaaya vaakyaghadana yathaakramam ithaanu
function polulla" macro declarationil identifierinum aadyathethu, ooppaning, paranthasis ennivaykkidayil whitespace undaayirikkaruth. whitespace undengil, tokkan listtilekku cherttha aadyathe paranthasis muthal aarambikkunna ellaam upayogichu macro object poleyaanu vyaakhyaanikkappedunnathu.
oru macro nirvachanam coce _ 27 upayogichu neekkam cheyyaam
sozhs codil identifier drishyamaakumbozhellaam athu maattisthaapikkunna tokkan listt upayogichu maattisthaapikkunnu, athu shoonyamaayekkaam. oru function polulla macro aayi prakhyapikkappetta oru identifierinaayi, inipparayunna tokkan macro invokkeshante aargyument listt aarambikkunna idathu paranthasis aayirikkumbol maathrame athu maattisthaapikkappedukal. aargyumentukalulla function polulla maakrokalude vipuleekaranathinaayi pinthudarunna krithyamaaya nadapadikramam sookshumamaanu.
sthirathayude pratheekathmaka perukal srishtikkunnathinu nalla prograaming parisheelanatthinte bhaagamaayi object polulla maakrokal parambaraagathamaayi upayogichirunnu, udha.jii.,
kodiludaneelam haard-coding nambarukalkku pakaram. sii, sii + + ennivayil, prathyekichu nambarilekku oru pooyintar aavasyamulla saahacharyangalil, oru aagola variabililekku cockways _ 28 yogyathaapatram prayogikkuka ennathaanu oru badal. ithu preprosessorinu pakaram memmariyil moolyam sambharikkaan kaaranamaakunnu.
macro polulla oru functionte oru udaaharanam ithaa
ithu radian-tuu-digri parivartthanatthe nirvachikkunnu, athu aavashyamullidathu codil cherkkaan kazhiyum, i.iii., cocew _ 29. ithu inn-placeil vikasippichirikkunnu, athinaal codil udaneelam sthiraangam kondu aavarthichulla gunanam kanikkilla. oru macro aanennum allathe oru compile cheytha functionaanennum oonnipparayaan ivide macro ellah valiyaksharangalayi ezhuthunnu.
randaamathethu orotta moolyathinu pakaram oru padaprayogamaayirikkumbol thettaaya pravartthana kramatthinulla saadhyatha ozhivakkaan athintethaaya jody paraantheesukalil pothinjirikkunnu. udaaharanathinu, padaprayogam shariyaayi vikasikkunnu; paraantheesukalillaathe, gunanathinu munganana nalkunnu.
athupole, puram jody paraantheesukal sariyaaya pravartthana kramam nilanirthunnu. udaaharanathinu, paraantheesukalillaathe, vibhajanathinu munganana nalkunnu.
vipuleekarana kramam.
"function polulla" macro vipuleekaranam inipparayunna gattangalilaanu sambhavikkunnath
ithu athisayakaramaaya phalangal nalkiyekkaam
poocha (avan, loow)// "haay avide", kaaranam saadhaarana vipuleekaranathinu munbaanu samyojanam sambhavikkunnath.
xcat (He, llo)// hy _ there, kaaranam paaraamettarukalil ninnu uthbhavikkunna tokkanukal ("He", "llo") aadyam vikasippikkunnu.
aadyam paraameterukal vipuleekarikkunnathinal (poocha)// "haay dher" ennu vilikkuka.
prathyeka maakrokalum nirddeshangalum.
preprosessing samayat chila chinnangal nadappaakkikkond nirvachikkendathundu. preprosessor thanne munkootty nirvachichirikkunna cocks _ 30, cocks _ 31 enniva ithil ulppedunnu, avaa nilavile fayalilekkum line nambarilekkum vikasikkunnu. udaaharanathinu, thaazhepparayunna kaaryangal
// sandeshathinte uthbhavam ottanottathil pinn cheyyaan maakrokale debug cheiyunnu
// moshamaan
// allengil
// nallathaano?
 debug print ("hayee, x =% d\n", x);
pishak streamilake fayalinteyum line nambarinteyum munpulla cockways _ 32-nte moolyam print cheyyuka, ithu sandesham eathu variyil nirmmichuvennu vegathil axus cheyyaan anuvadikkunnu. cockways _ 33 aargyument athine pinthudarunna stringumaayi samyojippichirikkunne shradhikkuka. cocks _ 30, cocks _ 31 ennivayude moolyangal cocks _ 36 directive upayogichu kaikaaryam cheyyaan kazhiyum. cockways _ 36 directive thaazhe koduthirikkunna variyude line number fayalinte perum nirnnayikkunnu. iii.jii.:
printef ("varii =% d phayal =% s\n", _ _ varii _, _ _ phayal _ _);
printef function srishtikkunnu
print eph ("varii =% d phayal =% s\n", 314 ", paii.sii);
sozhs coode debuggerukal cockways _ 30, cockways _ 31 enniva upayogichu nirvachichirikkunna sozhs position soochippikkunnu.
thikachum vyathyasthamaaya oru bhashaykkaayi oru compilerinte taargett bhashayaayi sii upayogikkumbol ithu sozhs coode debugging anuvadikkunnu.
nadappaakkal aii. ezz. oo staanderdumaayi poruthappedunnuvenkil macro cocks _ 40 neey 1 ennum 0 ennum nirvachikkanamenn aadyathe sii staanderd vyakthamaakkunnu, koodaathe macro cocks _ 41 nadappaakkal pinthunaykkunna staanderdinte pathipp vyakthamaakkunna oru samkhyaa aksharaarthamaayi nirvachikkunnu. staanderd sii + + compilerukal cockways _ 42 macro pinthunaykkunnu. staanderd allatha modil pravartthikkunna compilerukal eee maakrokal sajjamaakkaruth allengil vyathyaasangal soochippikkunnathinu mattullavare nirvachikkanam.
mattu staanderd maakrokalil nilavile theeyathi coach 43, nilavile samayam coach 44 enniva ulppedunnu.
sii staanderdinte randaam pathippaya sii99, athu adangiyirikkunna function nirvachanatthinte peru adangiyirikkunna cocks _ 45-nuu pinthuna chertthu, ennaal preprosessor sii-yude vyaakaranathin anjeyavaadiyaayathinaal, ithu compileril thanne functionilekku oru variable local upayogichu cheyyanam.
vyathyastha ennam aargyumentukal (variadic maakrokal) edukkaan kazhiyunna maakrokal c89-ll anuvadaneeyamalla, pakshe niravadhi compilerukal avatharippikkukayum c99-ll staanderd cheyyukayum cheythu. variadic maakrokal prathyekichum upayogapradamaanu, udaaharanathinu, munnariyippukalum pishakukalum loggin cheyyumbol, kokvi _ 46 polulla variable ennam paaraamettarukal edukkunna pravarthanangalilekku rapperukal ezhuthumbol.
sii preprosessorinte ariyappedaatha oru upayoga reethi ex-macross ennariyappedunnu. oru ex-macro oru header fayalaanu. saadhaaranayaayi ivar ekstenshan upayogikkunnu.parambaraagatha" ennathinu pakaram "def".echu.  eee fayalil samanamaaya macro kolukalude oru listt adangiyirikkunnu, avaye "ghadaka macross" ennu vilikkam. incled phayal pinneedu aavarthichu paraamarshikkappedunnu.
pala compilerukalum adhikavum nilavaaramillaathathumaaya maakrokale nirvachikkunnu, ennirunnaalum iva palappozhum moshamaayi rekhappeduthappedunnu. eee maakrokalude oru pothu paramarsham munkootty nirvachicha sii/sii + + compiler macross projakttaanu, ithu "maanadandangal, compilerukal, operating sisttangal, hardware aarkkitekcharukal, compile-timil adisthaana rann-time librarikal polum thirichariyaan upayogikkaavunna vividha munkootty nirvachicha compiler maakrokal" pattikappedutthunnu.
tokkan stringification.
oopparettar (stringification oopparettar allengil string oopparettar ennariyappedunnu) oru tokkanine sii string aksharaarthatthil parivartthanam cheiyunnu, eathenkilum udharanikalil ninno back slaashukalil ninno uchithamayi rakshappedunnu.
udaaharanam
p =\" "foo\n" ";)// outtputtu cheiyunnu" "p =\" "foo\ \n" ";"
\n" ennathinte outtputtu "" \n ""// "" "
ningalkk oru macro aargyumentinte vipuleekaranam karshanamaakkanamenkil, ningal rund thalatthilulla maakrokal upayogikkanam
phuu" ennathinte outtputtu stru (phuu)//"
xstr (foo)// aouttputtukal "4"
ningalkk oru macro aargyumentine adhika vaachakavumaayi samyojippikkaanum ellaam orumichu strinfy cheyyaanum kazhiyilla. ennirunnaalum ningalkk aduthulla string sthiraangangaludeyum stringfide aargyumentukaludeyum oru parambara ezhuthaam sii compiler aduthulla ellah string sthiraangangaleyum oru neenda stringlake samyojippikkum.
tokkan samyojanam.
kokwos _ 47 oopparettar ("tokkan pasting oopparettar" ennariyappedunnu) rund tokkanukale oru tokkanayi samyojippikkunnu.
udaaharanam
declair _ struct _ type (g _ object);// aouttputtukal type def struct g _ object _ s g _ object _ t;
upayokthaav nirvachicha samahara pishakukal.
kookk _ 26 directive error streamiloode oru sandesham outtputtu cheiyunnu.
bainari vibhava ulppeduthal.
c23 bainari resource ulppeduthalinaayi cocewy _ 49 nirddesham avatharippikkum. ithu bainari fayalukal (chithrangal polullava) saadhuvaaya sii sozhs fayalukalaayi (exbm polullava) illaathe, kokwos _ 50 polulla baahya upakaranangal upayogichu prosess cheyyaatheyum emsvcyil dairkhya paridhiyulla string aksharangal upayogikkatheyum prograamil ulppeduthaan anuvadikkunnu. athupole thanne kookk _ 50-nuu pakaram nirddishta resourcinte daattayumaayi bandhapetta poornnasamkhyakalude oru cooma verthiricha pattikayaanu nirddeshathinu pakaram vaykkunnathu. soukaryathinu purame, compilerukalkku kaikaaryam cheyyaanum kochis 49 eluppamaanu, kaaranam niyamam anusarichu nirddesham athinte poornna roopathilekku vipuleekarikkaan avarkk anuvaadamundu.
ulcherkkenda phayal cocew _ 1 nuu samanamaaya reethiyil vyakthamaakkam, athaayath, shevronukalkkidayilo udharanikalkkidayilo. fayalinte peru pinthudarunna athinte swabhaavam ishtaanusrithamaakkunnathinna chila paaraamettarukal kaimaran nirddesham anuvadikkunnu. sii staanderd inipparayunna paaraamettarukal nirvachikkukayum nadappaakkalukk avaa svanthamaayi nirvachikkukayum cheyyaam. ulppeduthiya daattayude veethi parimithappedutthaan qoq 54 paaraameettar upayogikkunnu. yurandam polulla "ananthamaaya" fayalukalkkaayi ithu kooduthalum upayogikkaan uddeshichullathaanu. cocks _ 55, cocks _ 56 paaraamettarukal prograamare ulchertha daattayude prefix suffix vyakthamakkaan anuvadikkunnu, ithu ulchertha resource shoonyamallengil maathram upayogikkunnu. avasaanamaayi, resource shoonyamaanengil (phayal shoonyamaanengilo 0 enna paridhi vyakthamaakkiyittunde sambhavikkunnath) cockways _ 57 paaraameettar muzhuvan nirddeshatheyum maattisthaapikkunnu. ellah staanderd paaraamettarukalum eratta underscorukalaal chuttappettekkaam, c23 leeii staanderd attributeukal pole, udaaharanathinu cacos _ 58 cacos _ 55-maayi parasparam maattaavunnathaan. nadappaakkal-nirvachikkapetta paaraamettarukal attribute vaakyaghadanaykku samanamaaya oru phoom upayogikkunnu (udha.jii. 60) ennaal chathura brackettukal illaathe. ellah staanderd paaraamettarukalilum avarkk oru aargyument kaimaarendathundu (udha.jii. paridikk oru veethi aavasyamaanu) ithu saadhaaranayaayi oopshanalaanu, oru aargyument aavashyamillengil oru koottam paraantheesukal polum ozhivakkaam, ithu chila nadappaakkal nirvachikkapetta paaraamettarukalude kaaryathilaakaam.
nadappaakkal.
ellah sii, sii + +, objective-sii nadappaakkalukalum oru preprosessor nalkunnu, kaaranam preprosusing aaa bhaashakalkk aavashyamaaya gattamaanu, koodaathe athinte swabhaavam iso sii staanderd polulla eee bhaashakalude audyogika maanadandangalaal vivarikkappedunnu.
nadappaakkalukal avarude swantham vipuleekaranangalum vyathiyaanangalum nalkiyekkaam, koodaathe rekhaamoolamulla maanadandangal paalikkunnathinte alavil vyathyaasappedaam. avarude krithyamaaya perumaattam abhyarthanayil nalkunna command-line flaagukale ashrayichirikkum. udaaharanathinu, chila flagukal vitharanam cheiyunnathiloode gnu sii preprosessorine kooduthal maanadandangal palikkaan kazhiyum.
compiler-nirddishta preprosessor savisheshathakal.
compiler wendermark avarude swantham aavasyangalkkaayi upayogikkaavunna oru compiler-nirddishta nirddeshamaanu kokvi _ 61 directive. udaaharanathinu, nirddishta pishak sandeshangal adichamarthunnathinum koombaaram, staakk debugging enniva niyanthrikkunnathinum oru cockways _ 61 palappozhum upayogikkunnu. ooppanempi samanthara library pinthunaykkunna oru compilerinu oru kokvi 63 looppine kokvi 64-maayi samaantharamaakkaan kazhiyum.
floating-pooyint nadappaakkal niyantrikkaan upayogikkunna qoq 66 enna roopathil sii99 kurachu staanderd qoq 61 nirddeshangal avatharippichu. badal, macro polulla roopavum chertthu.
// gnu, intal, ibm
// microsopht
bhasha-nirddishta preprosessor savisheshathakal.
chila bhaashakalude savisheshathakal anusarichu sii preprosessoril chertthathum paranja bhaashakalkk prathyekathayullathumaaya chila preprosessor nirddeshangalundu.
mattu upayogangal.
sii preprosessor vitharanam cheiyunna compileril ninnu vevvere vilikkaan kazhiyunnathinaal, athu vividha bhashakalil vevvere upayogikkaam. ippol kaalaharanapetta aimekk samvidaanathilum preprosessing fortran samvidaanathilum ithu upayogikkunnathu sradheyamaaya udaaharanangalil ulppedunnu. ennirunnaalum, oru pothu uddeshya preprosessor enna tharatthilulla upayogam parimithamaann inputt bhasha mathiyaya sii-poleyaayirikkanam. chila phayal ekstenshanukal upayogichittundengil fortran coode compile cheiyunnathinu munbu gnu fortran compiler yaanthrikamaayi "parambaraagatha mooad" ennu vilikkunnu (chuvade kaanuka). samanamaaya kazhivukalulla ifort compilerinoppam upayogikkunnathinu intal oru fortran preprosessor, efpipi vaagdaanam cheiyunnu.
mikka assembly bhaashakalilum algol polulla bhaashakalilum sii. pii. pii sveekaaryamaayi pravartthikkunnu. ithinu bhasha vaakyaghadana sii. pii. pii vaakyaghadanayumaayi vairudhyam kaanikkarut, athaayath qoq 71 ll aarambikkunna varikalilla, sii. pii. pii string aksharangalayi vyaakhyaanikkukayum angane avaganikkukayum cheiyunna eratta udharanikalkku athallathe vaakyaghadana ardhamilla. parambaraagatha mooad" (pree-isoo sii preprosessor pole pravartthikkunnu) saadhaaranayaayi kooduthal anuvadaneeyavum atharam upayogathinu kooduthal anuyojyavumaanu.
sii preprosessor turing poornnamalla, pakshe athu valare aduthaanu aavarthana kanakkukoottalukal vyakthamaakkam, pakshe aavarthanathinte alavil oru nischitha upper boundu upayogichu. ennirunnaalum, sii preprosessor oru pothu-uddeshya prograaming bhashayaayi roopakalppana cheythitilla, athu nannayi pravartthikkunnumilla. sii preprosessorinu recursive maakrokal, udharani anusarichu selective expansion, kandeeshanalukalile string ivaaluveshan thudangiya mattu chila preprosessorukalude savisheshathakal illaathathinaal, emm 4 polulla kooduthal pothuvaaya macro prosessorumaayi thaarathamyappeduthumbol ithu valare parimithamaanu.

