projektovanje sistemskog softvera - …people.etf.unsa.ba/~samir.ribic/files/pssudzbenik3.pdf · 3...

191
ELEKTROTEHNIČKI FAKULTET UNIVERZITETA U SARAJEVU mr Ribić Samir, dipl.el. ing PROJEKTOVANJE SISTEMSKOG SOFTVERA (radna skripta) (treće izdanje) Sarajevo, 2005

Upload: hoangcong

Post on 05-Jun-2018

337 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

ELEKTROTEHNIČKI FAKULTETUNIVERZITETA U SARAJEVU

mr Ribić Samir, dipl.el. ing

PROJEKTOVANJESISTEMSKOGSOFTVERA

(radna skripta)(treće izdanje)

Sarajevo, 2005

Page 2: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

2

Page 3: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

3

1. VRSTE SISTEMSKOG SOFTVERA

Prije učenja razvoja sistemskog softvera potrebno je upoznati se sa osnovnim vrstama sistemskog softvera

1.1. Sistemski softver

Sistemski softver je svaki softver namijenjen za izvršenje aplikativnih programa, ali koji nije specifičan ni za jednu posebnuaplikaciju. Sistemski softver tipično uključuje operativne sisteme za kontrolu izvršenja programa, softver za korisničkookruženje kao što su interpretatori komandne linije, prozorski sistemi i desktopi, razvojne alate kao što su asembleri,kompajleri, linkeri biblioteke, interpreteri, generatori unakrsnih referenci, kontrolori verzija, make programi, debageri,profajleri i softver za praćenje te pomoćne alatke za sortiranje, štampanje i editovanje i mnogi drugi softver.

1.2. Sistemski softver za kontrolu izvršenja programa

- Operativni sistemiOperativni sistem je softver koji kontroliše izvršenje računarskih programa i pruža pored toga različite servise.- BIOSi i ROM monitori Softver koji se obično nalazi u fiksnoj memoriji ROM i omogućuje minimalni rad računara zaključno sa učitavanjemoperativnog sistema dijeli se na BIOSe i monitore. BIOS obično sadrži samo pasivne rutine koje operativni sistemi koristei koje omogućuju rad sa osnovnim periferijskim uređajima, dok ROM monitori imaju i neke primitivne metode zainterakciju s korisnicima.- LoaderiLoader (punilac) smješta korisnički program smješten na periferijskom uređaju u fizičku memoriju obavljajući pri tomerelokaciju programa na odgovarajuće adrese i učitavanje dinamičkih biblioteka ako ih program koristi.- SimulatoriSimulator je mašina ili program koji simulira željeno okruženje (može biti drugi računar, hemijski proces, sociološkisistem ili bilo šta drugo) u svrhu učenja ili istraživanja.- EmulatoriSpecijalizovani simulator koji simulira drugu mašinu i arhitekturu u odnosu na onu na kojoj se izvršava omogućivšiupotrebu gotovo svog softvera namijenjenog za drugu mašinu naziva se emulator.- DrajveriDrajver je program koji određuje kako će kompjuter komunicirati sa periferijskim uređajem u svrhu standardiziranog radaaplikativnih programa sa periferijskim uređajima.- DBMS ServeriProgrami koji brinu o centralizovanom čuvanju podataka u cilju brzog dobivanja podataka nazivaju se serveri zaupravljanje bazom podataka (DataBase Management Server)- SpuleriVrše raspoređivanje slanja podataka na printere kako bi se izbjeglo miješanje podataka na papiru- Mrežni serveriProgrami koji omogućavaju pristup raznim vrstama informacija preko mreže

1.3. Softver za korisničko okruženje

- Interpreteri komandne linijeInterpreter komandne linije je program koji čita tekstualne komande od strane korisnika ili iz datoteke i izvršava. Neke odovih komandi se izvršavaju unutar samog interpretera, dok druge izazivaju startovanje drugih datoteka.- Grafi čki sistemi prozoraGrafički sistem prozora je softver koji omogućuje da se ekran radne stanice podijeli u pravougaona područja koja seponašaju kao odvojeni ulazno/izlazni uređaji pod kontrolom različitih aplikativnih programa, što daje korisniku mogućnostda vidi izlaz iz različitih procesa istovremeno i odabere koji će primati ulaz, obično pokazavši na njega mišem.

1.4. Razvojni alati

- AsembleriAsembleri prevode program u asemblerskom jeziku u mašinski jezik.- KompajleriKompajler dekodira instrukcije napisane u jeziku višeg nivoa i proizvodi program u asemblerskom ili mašinskom jeziku.- LinkeriLinkeri kombinuju jednu ili više datoteka koje sadrže objektni kod iz separatno prevedenih modula u jedinstvenu datotekukoja sadrži učitljiv ili izvršni kod. Ovaj proces zahtijeva razrješenje referenci među modulima i popravku informacija orelokaciji koje koristi jezgro operativnog sistema prilikom učitavanja datoteke u memoriju radi izvršenja programa koji jeu njoj.- ParseriParseri su programi koji dijele kod u funkcionalne komponente. Obično su sastavni dio kompajlera.- Kompajler kompajleri

Page 4: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

4Kompajler kompajleri su alatke koje generišu izvorni kod parsera, interpretera ili kompajlera iz navedenog opisa jezika(obično u BNF formi)- DisasembleriDisasembleri prevode program u mašinskom jeziku u program u asemblerskom jeziku.- DekompajleriDekompajleri prevode program u mašinskom jeziku ili pseudomašinskom kodu u jezik visokog nivoa.- Kros asembleriKrosasembleri su asembleri koji se izvršavaju na drugoj vrsti računarske arhitekture od one čiji se mašinski kod generiše.- Kros kompajleriKrosakompajleri su kompajleri koji se izvršavaju na drugoj vrsti računarske arhitekture od one čiji se mašinski kodgeneriše.- InterpreteriInterpreteri su programi koji prevođenje izvornog jezika i izvršavanje prevedenog koda obavljaju u istom ciklusu običnoobrađujući po jednu liniju u vremenu.- PseudokompajleriPseudokompajleri su varijanta kompajlera koja ne generiše pravi mašinski kod, nego pseudomašinski kod koji je nižegnivoa od izvornog jezika, ali zahtijeva poseban interpreter za svoje izvršavanje.- PseudoasembleriPseudoasebmleri su varijanta asemblera koja ne generiše pravi mašinski kod, nego pseudomašinski kod koji je nižeg nivoaod izvornog jezika, ali zahtijeva poseban interpreter za svoje izvršavanje.- Profajleri i monitori performansiProfajleri mjere vrijeme provedeno u pojedinačnim dijelovima korisničkog programa u svrhu poboljšanja brzineaplikacije. Monitori performansi mjere zauzeće raznih vrsta resursa (procesora, memorije, diska, mreže...) u sistemu.- Generatori unakrsnih referenciGeneratori unakrsnih referenci prikazuju odnose između različitih procedura u različitim modulima.- Kontrolori verzijaDa bi se izbjegli konflikti između različitih programera koji rade nad istim datotekama izvornog koda, uvode se kontroloriverzija koji čuvaju centralizovano sve datoteke iz navedenog projekta uključivo i njihove ranije verzije.- Translatori izvornog kodaTranslatori izvornog koda prevode program napisan u jednom programskom jeziku višeg nivoa u drugi programski jezikvišeg nivoa.- Generatori izvornog koda i CASE alatiGeneratori izvornog koda automatski generišu izvorni kod u višem programskom jeziku ili asemblerskom jeziku na bazinavedenih parametara. Integrisani sa softverom za projektovanje čine CASE alate (Computer Aided SoftwareEngineering)- makeMake je program koji određuje, zavisno od vremena zadnje izmjene datoteka, da li je potrebno pokretati asemblere,kompajlere i linkere nad određenim datotekama.- DebageriDebageri su programi koji pomažu u lociranju i ispravci grešaka u programima. Mogu da prate programe na nivouizvornog i izvršnog koda- BibliotekeSkup potprograma namijenjenih programerima koji obavljaju određene funkcije

1.5. Pomoćne alatke

- Editori Programi koji obavljaju funkcije uređivanja, modifikacije i brisanja podataka zovu se editori. Editori mogu bitispecijalizovani za tekstualne ili binarne podatke.- SortiračiSortirači su programi za uređivanje podataka određenim redoslijedom- Backup programiBackup programi kopiraju podatke na pomoćni medij radi njihovog čuvanja u slučaju gubitka- Kriptografski programiKriptografski programi šifriraju podatke u nečitljiv oblik radi sprečavanja neovlaštene analize- Kompresioni programiKompresioni programi konvertuju podatke u formate koji zauzimaju manje memorijskih resursa- Mrežni klijentiMrežni klijenti koriste usluge mrežnih servera u svrhu prijema i obrade podataka

1.6. Rezime poglavlja

Navedeno je dosta definicija različitih vrsta sistemskog softvera koji obuhvata softver za kontrolu izvršenja programa,korisničko okruženje, razvojne i pomoćne alatke.

Page 5: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

5

2. PROCESOR I OPERATIVNI SISTEM ZA KOJE SE GENERIŠE KÔ D

Intelov Pentium je danas apsolutno dominantan mikroprocesor, pa će se i u navedenim primjerima on koristiti urazvoju kompajlera. Slijedi upoznavanje sa najvažnijim registrima i instrukcijama ovog procesora:

2.1. Registri

Za aplikativne programe na mikroprocesorima 486 i Pentium bitni su sljedeći 32 bitni registri:

• EAX , donjih 16 bita se zove AX , donjih 8 bita se zove AL

• EBX, donjih 16 bita se zove BX, donjih 8 bita se zove BL

• ECX, donjih 16 bita se zove CX, donjih 8 bita se zove CL

• EDX, donjih 16 bita se zove DX, donjih 8 bita se zove DL

• ESI, donjih 16 bita se zove SI

• EDI , donjih 16 bita se zove DI

• ESP, donjih 16 bita se zove SP

• EBP, donjih 16 bita se zove BP

• EFLAGS koji se sastoji od flegova (jednobitnih vrijednosti), od kojih su najvažniji:

CF – postavlja se na 1 ako se desio aritmetički prijenos,

ZF - postavlja se na 1 ako je rezultat operacije jednak 0,

DF – određuje da li će se registri SI i DI uvećavati ili umanjivati nakon svake instrukcije koje operišu sa memorijskimblokovima (MOVS, SCAS itd),

OF – postavlja se na 1 ako je rezultat operacije između dva predznačena broja broj netačnog predznaka,SF – postavlja se na 1 ako je rezultat operacije negativan broj

• FP koprocesor posjeduje osam 128 bitnih registara koji su organizovani u formi kružnog bafera i zovu se ST(0),ST(1) , ST(2) , ST(3) , ST(4) , ST(5) , ST(6) , ST(7) .

2.2. Adresni režimi

• Ako se u instrukciji navodi samo ime registra, tada se pristupa vrijednosti koju on sadrži, npr. INC EAX .

• Navodi li se ime registra u uglastoj zagradi, uz eventualni pomak, npr.

MOV ESI,[EBP+12] , pristupa se vrijednosti koja se nalazi na adresi koju bi pokazivao navedeni registar kada bibio uvećan za navedeni pomak. Ako je pomak jednak 0, tada se on ne navodi, npr. ADD ECX,[EBX]

• Umjesto apsolutnih adresa, mogu se u asemblerskom kodu navoditi labele, npr.

MOV GLOBALV[20] ,EAX

• Za distinkciju veličine varijable navode se modifikatori BYTE PTR, WORD PTR , DWORD PTR i QWORDPTR, koji predstavljaju 8, 16, 32 ili 64 bit.

• Dekadne konstante se navode jednostavno, npr. MOV EDX,1221. Heksadekadne konstante imaju znak hnaveden iza konstante. Ako instrukcije imaju dva operanda, rezultantni je obično prvi navedeni operand i on nemože biti konstanta. Nisu dopuštene ni instrukcije koje operišu između dvije memorijske lokacije. Moraju se utim slučajevima koristiti registri za međurezultate.

2.3. Instrukcije

U tabeli na slici Sl. 2.3.1 dat je spisak korištenih instrukcija. Argumenti instrukcija su navedeni kao $C1 i $C2 iumjesto njih se navode imena registara ili memorijske lokacije kao u podpoglavlju 2.2.

Opšti oblik Opis Primjer

ADD $C1,$C2 Sabira $C1 sa $C2 i rezultat smješta u $C1 ADD EAX,[ESI]

AND $C1,$C2 Logički konjuguje bit po bit $C1 sa $C2 i rezultat smješta u $C1 AND SI,3

CALL $C1 Poziva potprogram na navedenoj adresi CALL PODPROGRAM

CDQ Predznačno proširuje EAX u EDX. Najviši bit registra EAX se kopira u sve bite registra EDX. CDQ

CLD Briše directional flag, potrebno za instrukcije blokova CLD

Page 6: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

6CMP $C1,$C2 Poredi $C1 sa $C2 i ažurira flegove CMP EAX,PODATAK[8]

FADD Sabira dva broja na vrhu FP steka i rezultat smješta na vrh FP steka umjesto njih FADD

FCHS Mijenja predznak broju na vrhu FP steka FCHS

FCOMPP Poredi dva broja na vrhu FP steka, briše ih, a postavlja flegove koprocesora FCOMPP

FDIVR Dijeli broj ispod vrha FP steka sa brojem na vrhu FP steka i rezultat stavlja umjesto njih FDIVR

FILD $C1 Cjelobrojnu vrijednost sa memorijske lokacije stavlja na vrh FP steka FILD DWORD PTR [EBX]

FINIT Inicijalizira matematički koprocesor FINIT

FISTP $C1 Vrijednost sa vrha FP steka konvertuje u cjelobrojnu i stavlja u navedenu memorijskulokaciju

FISTP DWORD PTR [ESP]

FLD $C1 FP vrijednost iz memorije stavlja na vrh steka FLD QWORD PTR [EBP+2]

FMUL Množi dva broja na vrhu steka i rezultat smješta na vrh steka umjesto njih. FMUL

FSTP $C1 Vrijednost sa vrha FP steka stavlja u navedenu memorijsku lokaciju FSTP REZULTAT

FSTSW AX Flegove koprocesora prebacuje u AX registar FSTSW AX

FSUBR Od broja ispod vrha FP steka oduzme broj na vrhu FP steka i rezultat stavlja umjesto njih FSUBR

IDIV $C1 Predznačno dijeli 64 bitni broj čija je viša riječ u EDX a niža u EAX sa navedenim 32 bitnimregistrom ili sadržajem memorijske lokacije, rezultat stavlja u EAX, ostatak u EDX

IDIV ECX

IMUL $C1 Predznačno množi EAX sa navedenim registrom. Viša riječ 64-bitnog rezultata je u EDX aniža u EAX

IMUL ECX

JMP $C1 Program nastavlja izvršavanje od adrese navedene. JMP LABELA2

JNE $C1 Skače na navedenu adresu ako Zero flag nije jednak 1 JNE NETACNO

LEA $C1,$C2 U registar $C1 se smješta adresa operanda $C2 LEA EAX,[ESI+5]

MOV $C1,$C2 U registar $C1 se smješta vrijednost operanda $C2 MOV ECX,EDI

MUL $C1 Nepredznačno množi EAX sa navedenim registrom. Viša riječ 64-bitnog rezultata je u EDX aniža u EAX

MUL ESI

NEG $C1 Mijenja predznak cijelog broja NEG EAX

NOT $C1 Logički invertuje sve bitove cijelog broja NOT DWORD PTR [EDI]

OR $C1,$C2 Logička disjunkcija bit po bit $C1 sa $C2 i rezultat smješta u $C1 OR EAX,EDX

POP $C1 Sa adrese koju pokazuje ESP uzima vrijednost, smješta je u navedeni registar i uveća ESPza 4

POP ESI

PUSH $C1 Umanji ESP za 4 i na adresu koju pokazuje ESP smješta navedenu vrijednost PUSH EBP

REP MOVSB Prebacuje blok velik ECX bajtova sa adrese navedene u ESI na adresu koju pokazuje EDI REP MOVSB

RET $N1 Smjesti broj sa vrha steka u programski brojač, čime se vraća iz potprograma i uveća ESPza navedenu vrijednost

RET 8

SAHF Prebacuje bite iz AH u Flag registar SAHF

SAL EAX,$N1 Pomjera ulijevo EAX za navedeni broj bita SAL EAX,4

SETA AL Postavlja AL na 1 ako je CF =1, ZF=0 , inače AL postaje 0 SETA AL

SETB AL Postavlja AL na 1 ako je CF =1, ZF=0 , inače AL postaje 0 SETB AL

SETE AL Postavlja AL na 1 ako je ZF=1 , inače AL postaje 0 SETE AL

SETG AL Postavlja AL na 1 ako je SF<>OF, ZF=0, inače AL postaje 0 SETG AL

SETL AL Postavlja AL na 1 ako je SF =OF, ZF=0 , inače AL postaje 0 SETL AL

SETNE AL Postavlja AL na 1 ako je CF =1, ZF=0 , inače AL postaje 0 SETNE AL

SUB $C1,$C2 Oduzima $C2 od $C1 i rezultat smješta u $C1 SUB ECX,2

XOR $C1,$C2 Logička ekskluzivna disjunkcija $C1 sa $C2 i rezultat smješta u $C1 XOR EAX,8

Sl. 2.3.1. Instrukcije Intel Pentium korištene u generisanju koda

2.4. Operativni sistem

Operativni sistem za koji se generiše kôd u kompajleru koji slijedi je 32 bitni Windows. Generisani programi supredviđeni da rade na njegovim verzijama počevši od Windows 3.1 sa Win32s, Windows 95, 98, ME, NT (sve verzije – 3.1,3.5, 3.51 i 4.0),Windows 2000 i Windows XP.

Generisani kôd je za korisnički režim rada i omogućava pozive izuzetno velikog broja sistemskih funkcija. Na ovajnačin, jezik ima bogatu podršku u bibliotekama procedura. Sistemske funkcije se nalaze u dinamičkim DLL datotekama.

2.5. Rezime poglavlja

Intelovi mikroprocesori 486 i Pentium imaju veliki broj instrukcija i umjeren broj registara. U ovom poglavlju sunavedene samo one instrukcije i adresni režimi koje su zaista korištene u generisanju asemblerskog koda. Generisani kôd jepredviđen za korisnički režim rada pod operativnim sistemom Windows-32.

Page 7: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

7

3. UOBIČAJENI PRISTUPI U RAZVOJU KOMPAJLERA

Osoba zainteresovana za pisanje novog ili analizu postojećeg kompajlera, bilo opisanog u udžbenicima, bilo izizvornog kôda, uglavnom ima na raspolaganju četiri pristupa:

• Iterativni pristup

• Primjena generatora koda

• Analiza gotovog kompajlera

• Crenshawova netehnička metoda

3.1. Iterativni pristup

Ovaj pristup je najčešće opisan u udžbenicima. Kompajler se dijeli na glavne cjeline: leksički analizator, sintaksnianalizator, semantički analizator, virtuelna mašina, generator koda, interpreter virtuelne mašine i optimizator koda. Cijeliprogramski jezik i kompajler se prethodno projektuju, a zatim se razvijaju cjeline navedene gornjim redoslijedom, uzobjašnjenje teoretskih osnova parsiranja. Prednosti pristupa su

• Ovaj pristup je vrlo sistematičan i uglavnom ne divergira od izvorne ideje kako bi konačna verzija jezika trebala daizgleda. Konačna verzija je najčešće podskup nekog klasičnog programskog jezika.

• Pristup je primjenjiv za širok dijapazon kompajlera za razne programske jezike, ali i razvoj drugih sistemskihprograma: interpretera, translatora, asemblera, uljepšivača izvornog koda, itd.

Mane pristupa su:

• Nepogodan je za kratke kurseve. Ono čemu kompajler služi, generisanje koda, dolazi tek na kraju knjige ili kursa, paje potrebno preći oko 150-200 strana ili gotovo cijeli semestar da bi cijela tema imala smisla.

• Već u startu se operiše sa velikim listinzima, jer je odmah zamišljeno praćenje sintakse cijelog jezika.

• Obično se generiše kôd za virtuelnu, a ne realnu mašinu. Virtuelne mašine zahtijevaju poseban interpreter (uz tonepreglednog) pseudo koda, što umanjuje kvalitet kompajlera (spor i odvojen od sistema prevedeni program). Temašine su obično stek orijentisane, za razliku od realnih mašina koje su registarski orijentisane.

• Realizacija pojedinih jezičkih koncepata nije u skladu sa njihovim prioritetima. Koncept slogova je manje bitan odkoncepta cijelih brojeva, ali se ovim pristupom oba uče istovremeno.

3.2. Primjena generatora koda

Vrlo su popularni programi koji se zovu kompajler-kompajleri. Ovi programi (LEX, YACC, Bison, COCO/R) izBacus-Naurove forme generišu izvorni kôd leksičkog i sintaksnog analizatora koji se kasnije ručno proširuje. Prednosti ovogpristupa su:

• Skraćeno vrijeme razvoja, jer su dvije faze kompajliranja, leksička i semantička analiza, korektno već urađene.

• Prednosti iterativnog pristupa su zadržane.

Mane pristupa su:

• Automatski generisani kôd može biti prilično nepregledan, pa je potrebno vrijeme za njegovo shvaćanje.

• Upotrebom ovih alata se ne nauči kako se piše kompajler, nego kako se koriste ti alati.

• Prevelika je razlika između veličine kompaktne BNF forme i generisanog sintaksnog analizatora nastalog iz te BNFforme.

• Ostaje problem jezičkih koncepata različitog prioriteta.

3.3. Analiza gotovog kompajlera

Mnogi kompajleri se mogu naći na Internetu sa kompletnim izvornim kodom, a često i propratnom knjigom kojaobjašnjava rad kompajlera. Najpoznatiji takvi programi su GNU C i Small C. Izvorni kôd se može slobodno analizirati imodifikovati, mada se iz njega obično ne smiju praviti komercijalni kompajleri. Prednosti pristupa su:

• Mnogi besplatni kompajleri predstavljaju pune implementacije programskih jezika po ISO ili ANSI standardima.

Page 8: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

8• Gotovi kompajleri su posebno upotrebljivi za brzi razvoj kros-kompajlera (koji generišu kôd za druge platforme) ili

popravak optimizatora koda.

Mane pristupa su:

• Odštampani listinzi ovih kompajlera zauzimaju nekoliko stotina strana. Praćenje takvih listinga je izuzetno teško.

• Veliki listing ne daje mnogo informacija o tome kojim putem je on nastao.

• Ostaje problem jezičkih koncepata različitog prioriteta.

3.4. Crenshaw-ova netehnička metoda

Ova metoda je predložena u seriji članaka na Internetu “Let’s build a compiler”, autora dr Jacka Crenshawa u periodu1988-1993. Kreće se sa daleko manjim ambicijama, npr. varijable su jednoslovne i nema ključnih riječi, ali se odmah ide ugenerisanje koda, dok se sam jezik postepeno razvija. Prednosti pristupa su:

• Ako je vremenski faktor problem, čitalac može da odustane dosta rano, a da je ipak naučio suštinu procesa.

• Jezički koncepti se uvode prema svom značaju.

• Listinzi su u početku vrlo mali i jezgroviti (100-200 linija) a rastu dosta linearno.

• Odmah se razvija kôd za realnu mašinu i to generisanjem preglednog asemblerskog koda umjesto nepreglednogmašinskog koda ili pseudokoda.

Mane pristupa su

• Može doći do divergencije u razvoju. U originalnoj seriji članaka se to i dogodilo zbog zauzetosti autora i velikogvremenskog trajanja serije članaka, tako da serija nije dovedena do kraja, a tri puta se počinjalo iz početka.

• Ponekad prelazak u narednu fazu implementacije nije moguć zbog koncepata koje je nametnula prethodna faza. Naprimjer, ako je prethodna faza jezika definisala da se varijable deklarišu na određeni način, koji nije kompatibilan stipom podataka planiranom za uvođenje u narednoj fazi, tada treba ili odustati od tog tipa ili nanovo napisati dio kodakoji implementira deklaraciju varijabli.

• Originalna metoda, ne podržava neke bitne elemente savremenih programskih jezika, kao što su slogovi, nizovi,višedimenzionalni nizovi i veze s operativnim sistemom.

• Metoda ne podržava optimizaciju koda i oporavak od grešaka.

Pristup objašnjen u ovom radu je, u osnovi, Crenshaw-ov pristup, ali doveden do kraja, bez divergiranja, sa logičnimkoracima iz faze u fazu, te sa originalnim programskim jezikom koji se razvija u fazama. Sam kompajler je pisan bezkorištenja Crenshawov-og izvornog koda i pruža znatno veće mogućnosti.

3.5. Waterfall i spiralni pristup razvoju informacionih sistema

Klasične“waterfall” metodologije razvoja zasnivaju se na lancu: Analiza, Dizajn, Programiranje, Testiranje,Održavanje, Napuštanje( Sl. 3.5.1),

Sl. 3.5.1. Klasični “Waterfall” pristup razvoju softvera

Spiralni pristupi (Sl. 3.5.2) podrazumijevaju da se ove faze obavljaju svaki put kada se razvija nova verzija programa,proizišla iz stare. Tako se razvija sve moćniji i moćniji softver. Geometrijska forma spirale vjerno predstavlja ovo širenjesoftvera.

Analiza Dizajn

D Program Test

T Održava Napušt

a

Page 9: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

9

Sl. 3.5.2. Spiralni pristup u razvoju softvera

3.6. Programski jezik u kome se razvija kompajler

Pošto je svrha razvoja kompajlera za FILDZAN-32 njegova primjena u nastavi, odlučeno je da se sam kompajler pišeu programskom jeziku Pascal. Ta odluka danas zvuči neobično, jer se sistemski softver obično piše u jezicima C ili C++, alibitna prednost Pascala je u njegovoj preglednosti, što je od velike važnosti za nastavu. Treba reći da za Pascal već postojimnogo dobrih komercijalnih i besplatnih kompajlera kao što su Delphi, Kylix, FreePascal, TurboPascal, Virtual Pascal 2 iP2C. Kompajler za FILDZAN-32 je napisan tako da se lako prevodi bilo kojim od navedenih Pascal-skih kompajlera.

3.7. Hardversko i softversko okruženje za koje se razvija kompajler

Jedan od glavnih ciljeva ove metode je razvoj kompajlera koji generiše kôd za konkretno, a ne virtuelno okruženje. Sobzirom da na našem i svjetskom tržištu prevladavaju PC računari sa Intel 486 i Intel Pentium procesorima, izbor ovihmikroprocesora za generisanje koda je sasvim logičan. Ovi procesori uključuju i instrukcije za rad sa realnim brojevima.

Između dva vodeća operativna sistema za ove procesore, Windows i Linux, izabran je Windows kao, u ovomtrenutku, popularniji. Potrebne modifikacije kompajlera da generiše kôd za Linux su male.

Očekuje se da će operativni sistemi bazirani na kompatibilnosti s Microsoft Windows platformama i Intelovimmikroprocesora biti aktuelni bar do 2010 godine.

3.8. Rezime poglavlja

Uobičajeni pristupi, koji se mogu naći u literaturi, za učenje razvoja kompajlera su iterativni pristup, analiza gotovihkompajlera, primjena generatora koda i Crenshaw-ov netehnički pristup. Svi pristupi imaju svojih prednosti i nedostataka. Zakratke kurseve, koji trebaju da brzo daju konkretne rezultate najpogodniji je Crenshaw-ov pristup, ali je on često nepotpun. Uovom prikazu razvoja kompajlera je korištena unapređena Crenshawova metoda.

AD

PT

O

AD

P

T

OA

D

PT

O

Page 10: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

10

4. PROSTI ARITMETI ČKI IZRAZI

Svaki programer koji je imao iskustva u radu s asemblerskim i višim programskim jezicima prvo uočava drastičnurazliku u pristupu računanju aritmetičkih izraza. U višim programskim jezicima se oponaša klasična forma matematičkihizraza, kakva je u upotrebi još od 18. vijeka. Ova forma je, doduše, prilagođena računarskim tastaturama (kosa crtaumjesto razlomačke i zvjezdica umjesto podrazumijevanog množenja), ali su prioriteti računanja sačuvani. Unutar jednogizraza množenje ima prioritet nad sabiranjem, a zagrade nad ostalim operacijama.

4.1. Struktura tipi čnih aritmetičkih izraza

Asemblerski jezici (ali i neki viši programski jezici kao što su FORTH, Lisp, Befunge i rane verzije COBOL-a), sdruge strane, imaju instrukcije za istovremeno obavljanje samo jedne aritmetičke operacije nad dva argumenta. Programermora sam da odredi redoslijed izvršavanja ovakvih instrukcija da bi se dobio tačan rezultat izraza. Međurezultati se morajučuvati u registrima, memorijskim lokacijama ili na steku. Koliko ovo može biti komplikovano, svjedoči činjenica da jeznačenje imena prvog višeg programskog jezika FORTRAN zapravo skraćenica od “prevodilac formula”.

Stoga se i u ovom pristupu razvoju kompajlera kreće od prevođenja aritmetičkog izraza sa prioritetima uasemblerski program.

Dva su uobičajena načina rješavanja ovog problema, nerekurzivni i rekurzivni. Nerekurzivni način podrazumijevaprevođenje iz aritmetičke (infiksne) u obrnutu poljsku notaciju (postfiksnu). U ovom radu je primijenjen rekurzivni način, jeron dovodi do kraćih listinga programa i konzistentniji je sa opisom sintakse jezika u proširenoj BNF formi ili sintaksnimdijagramima.

Nakon gledanja jednog tipičnog aritmetičkog izraza 2+3*4-8+(7-6*2) sa jednocifrenim brojevima, ali sa prioritetima izagradama, uočavaju se cjeline prikazane na slici Sl. 4.1.1.

Sl. 4.1.1. Cjeline u aritmetičkom izrazu 2+3*4-8+(7-6*2)Pogledavši cjelinu C12 (cijeli izraz) uočava se da se izraz sastoji od jednog ili više članova razdvojenih

znakovima plus ili minus. Primjećuje se da i izraz C11 unutar zagrada ima istu strukturu.

Uočena struktura aritmetičkog izraza se predstavlja sintaksnim dijagramom na slici Sl. 4.1.2. Okruglim ili ovalnimznakovima predstavljaju se simboli koji se dalje ne razrađuju (terminalni) a četvrtastim oni simboli koji se razrađuju(neterminalni).

Izraz

Sl. 4.1.2. IzrazGledajući cjeline C1, C4, C5, i C11, te C10 i C9, uočava se da se član izraza sastoji od jednog ili više faktora,

razdvojenih zvjezdicom ili kosom crtom. Sam faktor je cifra ili, kao u cjelini C11, kompletan aritmetički izraz koji počinjeotvorenom zagradom. Na slikama Sl. 4.1.3 i Sl. 4.1.4 prikazani su sintaksni dijagrami pojmova Član i Faktor .

Član

Sl. 4.1.3. Član

Član

+

-Član

Faktor

/

*Faktor

C1=2 C2=3 C3=4 C4=C2*C3C5=8 C6=7 C7=6

C8=2 C9=C7*C8 C10=7 C11=(C10-C9)

C12=C1+C4-C5+C11

Page 11: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

11Faktor

Sl. 4.1.4. Faktor

4.2. Sintaksna analiza aritmetičkih izraza

Prateći sintaksne dijagrame, lako je sintaksno analizirati izraze. Svaki od dijagrama može se izdvojiti u posebnuPascal-sku proceduru, ili predstaviti odgovarajućim pseudokodom. Čvorišta u sintaksnim dijagramima gdje se pojam razdvajau više podslučaja se mapiraju u uslovna grananja u pseudokodu, a vraćanja na već pročitani simbol u dijagramu se mapiraju upetlje u pseudokodu. Stoga procedure Izraz , Faktor i Član izgledaju u pseudokodu kao na slici Sl. 4.2.1.

Sl. 4.2.1. Pseudokod: Izraz, Član, Faktor

4.3. Generisanje koda za računanje aritmetičke izraze

Intelovi 32 bitni procesori imaju umjeren broj procesorskih registara. Stoga, nije moguće cijeli aritmetički izrazdržati u registrima, ali ga nema smisla ni u potpunosti držati na steku ili memorijskim lokacijama. Pošto je prethodnimoperacijama izraz razložen na njegove sastavne komponente, uglavnom se operiše sa glavnim registrom, EAX i pomoćnimregistrom EBX. Trenutni međurezultat se uvijek čuva u registru EAX, u kome je i jedan od operanada. Drugi operand je uregistru EBX.

Lako je prevesti faktor koji se sastoji od jedne konstante. Dovoljno je izvršiti odgovarajuću komanduMOV EAX,NN da se konstanta smjesti u registar EAX. Npr. konstanta 3 se prevodi u MOV EAX,3

Kada su u pitanju prevođenja izraza ili članova, na primjer, čuvanje u registrima postaje nedovoljno. Stoga se priuočavanju sabiranja, oduzimanja, množenja ili dijeljenja, registar EAX mora sačuvati na steku, jer će poziv procedure zaračun drugog operanda promijeniti sadržaj ovog registra. Po okončanju ove procedure, vrijednost sa steka se stavlja u EBXregistar za komutativne operacije. Za nekomutativne operacije registar EAX se prebaci u EBX, a zatim vrijednost sa stekastavlja u EAX registar. Preostaje još da se obavi odgovarajuća ADD, SUB, IMUL ili IDIV instrukcija, čime registar EAXponovo sadrži međurezultat.

Tako se sabiranje prevodi u

( Izraz )

0

1

9

Izraz:

Pozovi ČlanSve dok je naredni simbol “+“ ili “- “ ,pozovi Član

Član:

Pozovi FaktorSve dok je naredni simbol “*” ili “/“ , pozovi Faktor

Faktor:

Ako je naredni simbol cifra, faktor je u redu,Ako je naredni simbol “(“pozovi Izraz, zatim očekuj simbol “)”U ostalim slučajevima, prijavi grešku.

Pozovi Član

Sve dok slijedi znak sabiranja, generiši naredne instrukcije

PUSH EAXPozovi Član

POP EBX

ADD EAX,EBX

Page 12: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

12Pozivom procedure Član uvijek se dobija međurezultat u EAX. Instrukcijom POP EBX se u EBX registar smješta

vrijednost sa vrha steka. Ako se sa stekom pažljivo postupa, što će se raditi u cijelom procesu razvoja, na vrhu steka senalazi sadržaj EAX registra nakon računanja prvog sabirka. Stoga će registar EBX imati vrijednost prvog sabirka, a registarEAX vrijednost drugog sabirka. Posljednjom instrukcijom dobija se zbir u registru EAX.

Kako je i množenje komutativno generisani kôd za množenje je sličan. IMUL instrukcija će uzgred pokvariti sadržajEDX registra, ali se bitan dio međurezultata čuva u EAX registru.

Pozovi Faktor

Sve dok slijedi znak množenja, generiši naredne instrukcijePUSH EAX

Pozovi Faktor

POP EBXIMUL EBX

Oduzimanje nije komutativno, pa se mora prvi operand smjestiti u EAX, a drugi u EBX. Stoga generisani kôd možeizgledati ovako:

Pozovi Član

Sve dok slijedi znak oduzimanja, generiši naredne instrukcijePUSH EAX

Pozovi ČlanMOV EBX,EAX

POP EAX

SUB EAX,EBXDakle, instrukcijom MOV EBX,EAX u registar EBX smiješta se drugi operand, dok će instrukcija POP EAX

pokupiti prvi operand sa steka.

Dijeljenje, pored toga što nije komutativno, zahtijeva da se u EDX nalazi predznačno proširen EAX registar, što seradi instrukcijom CDQ. Predznačno proširenje predstavlja kopiranje najvišeg bita EAX registra u sve bite EDX registra.

Pozovi Faktor

Sve dok slijedi znak dijeljenja, generiši naredne instrukcijePUSH EAX

Pozovi Faktor

MOV EBX,EAXPOP EAX

CDQ

IDIV EBXNakon cijele rutine, registar EAX će sadržati količnik, a EDX ostatak pri dijeljenju.

4.4. Prva verzija kompajlera

Nakon analize strukture aritmetičkog izraza i pseudokoda za sintaksnu analizu dijelova izraza te generisanjamašinskog koda, može se pristupiti pisanju prve verzije kompajlera u Pascalu. Na slici Sl. 4.4.1 data je prva verzijakompajlera, koji je prosti prevodilac prostog aritmetičkog izraza koji se unosi sa tastature i prikazuje na ekranu.

Page 13: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

13

Sl. 4.4.1. Prevodilacizraza

program Kompajler;var pozicija: integer; znak: char; linija: string;

procedure Emit(st: string);begin WriteLn(st);end;

procedure Novi;begin pozicija := pozicija + 1; if pozicija <= Length(linija) then znak := linija[pozicija] else Halt;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := ord(znak) - ord('0'); Novi; UzmiKonstantu := rezultat;end;

procedure Izraz; forward;

procedure Faktor;var rezultat: integer;

st: string;begin case znak of '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; Izraz; Novi; end else WriteLn('Greska'); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ');

Emit(' IDIV EBX'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; end; end;end;

begin pozicija := 0; ReadLn(linija); Novi; Izraz;end.

Iz listinga se uočava da pored procedura pored procedura Izraz, Clan i Faktor , koje su prikazane u pseudokodupostoje i procedure Emit , Novi i UzmiKonstantu. Procedura Emit je prosti ispis stringa na ekranu. Procedura Novi jenajznačajnija procedura. Ona varijablu pozicija uvećava za 1 i zatim dohvati odgovarajući znak iz unesene linije uvarijablu znak. Ta varijabla sadrži sljedeći simbol. Procedura UzmiKonstantu dohvata jednocifreni broj i koristeći funkcijuord dolazi do njegove numeričke vrijednosti.

4.5. Testni primjer

Sa tastature se unosi sljedeći izraz:

2+3*4-8+(7-6*2);

Kada ovaj primjer prođe kroz kompajler, dobije se asemblerski listing na slici Sl. 4.5.1. (Zadnji simbol u primjeru može bititačka-zarez, ali i bilo koji drugi jer se ignoriše). Uz asemblerski listing dat je komentar sadržaja registara i steka nakonizvršenja svake od instrukcija

MOV EAX,2 EAX=2, EBX=?, stek =() PUSH EAX EAX=2, EBX=?, stek =(2) MOV EAX,3 EAX=3, EBX=?, stek =(2) PUSH EAX EAX=3, EBX=?, stek =(3,2) MOV EAX,4 EAX=4, EBX=?, stek =(3,2) POP EBX EAX=4, EBX=3, stek =(2) IMUL EBX EAX=12, EBX=3, stek =(2) POP EBX EAX=12, EBX=2, stek =() ADD EAX,EBX EAX=14, EBX=2, stek =() PUSH EAX EAX=14, EBX=2, stek =(14) MOV EAX,8 EAX=8, EBX=2, stek =(14) MOV EBX,EAX EAX=8, EBX=8, stek =(14) POP EAX EAX=14, EBX=8, stek =() SUB EAX,EBX EAX=6, EBX=8, stek =()

PUSH EAX EAX=6, EBX=8, stek =(6) MOV EAX,7 EAX=7, EBX=8, stek =(6) PUSH EAX EAX=7, EBX=8, stek =(7,6) MOV EAX,6 EAX=6, EBX=8, stek =(7,6) PUSH EAX EAX=6, EBX=8, stek =(6,7,6) MOV EAX,2 EAX=2, EBX=8, stek =(6,7,6) POP EBX EAX=2, EBX=6, stek =(7,6) IMUL EBX EAX=12, EBX=6, stek =(7,6) MOV EBX,EAX EAX=12, EBX=12, stek =(7,6) POP EAX EAX=7, EBX=12, stek =(6) SUB EAX,EBX EAX=-5, EBX=12, stek =(6) POP EBX EAX=-5, EBX=6, stek =() ADD EAX,EBX EAX=1, EBX=6, stek =()

Sl. 4.5.1. Asemblerski listing prevedenog koda sa tokom izvršavanja

Dakle, kao rezultat izvršenja programa sa slike Sl. 4.5.1 dobiva se 1, što se slaže sa vrijednošću aritmetičkog izraza.Naravno da bi ručno pisani asemblerski program bio daleko kraći. No, računar gleda ulaz sekvencijalno i ne može odmahpojednostaviti program, jer ne vidi unaprijed da li je uopšte potrebno npr. sačuvati EAX registar. U ovom trenutkuoptimizacija koda ima niži prioritet jer se može i bez nje. Daleko je bitniji problem što su izrazi samo sa jednocifrenimbrojevima, nema varijabli i kontrolnih struktura, niti unarnih operatora. No, najveći nedostatak sadašnje verzije kompajlera

Page 14: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

14je što ona prevodi samo jednu jedinu liniju sa tastature na ekran. Prevedeni kôd se još uvijek ne može asemblirati, i njegovoizvršavanje se simulira na papiru.

4.6. Rezime poglavlja

Razvoj kompajlera kreće od prevodioca prostog aritmetičkog izraza. U strukturi jednog tipičnog aritmetičkog izrazasa zagradama i prioritetima uočavaju se određene cjeline, Izraz, Član i Faktor koje se definišu sintaksnim dijagramima irealizuju odgovarajućim procedurama. U realizacija četiri osnovne aritmetičke operacije se koriste odgovarajuće instrukcijemikroprocesora, a međurezultati se uvijek čuvaju u EAX. Prva verzija kompajlera prevodi samo uneseni aritmetički izraz, sjednocifrenim brojevima sa tastature. Testni primjer za prvu verziju kompajlera je uspješan, no programski jezik u ovomtrenutku nema nikakvih kontrolnih struktura, niti mogućnost prevođenja iz datoteka.

Page 15: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

15

5. PREVOĐENJE IZ DATOTEKA, BLOKOVI, VIŠECIFRENI BROJEVI

Prva verzija kompajlera prevodi samo jedan jedini aritmetički izraz u asemblerski jezik. Aritmetički izraz se ne možesačuvati na disku nego se svaki put mora ponovo unositi. Izlazne asemblerske naredbe se takođe ne mogu direktno proslijeditiasembleru u cilju generisanja izvršnog koda.

5.1. Format instrukcija

Da bi se ovaj prevodilac mogao zvati kompajlerom višeg programskog jezika a ne prevodiocem jednog izraza,neophodno je omogućiti da se izvorni kod iz jedne datoteke prevodi u asemblerski ili mašinski kod u drugoj datoteci. Iakopostoje kompajleri koji sve rade u memoriji, ipak su oni koji prevode iz datoteke u datoteku neuporedivo upotrebljiviji. Poredovoga, ulazni program treba da se sastoji od više naredbi ili aritmetičkih izraza, da bi se uopšte moglo govoriti o programu.

U ovom trenutku donosi se jedna ključna odluka u izboru koncepcije programskog jezika vezano za format pisanjanjegovih naredbi. U praksi postoje tri takva formata. Bajtovski format (mašinski jezik, Befunge, Forth) definiše da jednanaredba zauzima jedan bajt ili svega nekoliko njih. Linijski format (asemblerski jezik, Fortran, BASIC, XBASE) određuje dase jedna naredba (ponekad i više od jedne) sadrži u jednoj liniji izvornog koda. Slobodni format (Pascal, Lisp, C, Java) dopuštada se naredbe pišu u više redova. Kako je slobodni format ujedno i najpraktičniji, bit će primijenjen i u programskom jezikukoji se sada razvija.

Odluka o izboru slobodnog formata povlači sljedeću odluku: Da li za oznake početka i kraja grupe naredbi koristitiključne riječi (kao u Pascalu) ili simbole (kao u C-u). Prepoznavanje simbola je jednostavnije od prepoznavanja ključnih riječi,pa će ovaj jezik više podsjećati na C nego na Pascal, iako će kasnije imati elemenata i jednog i drugog jezika. Osim toga,ključne riječi će biti uvedene znatno kasnije.

5.2. Blokovi

Skup naredbi se zove blok i uokviren je vitičastim zagradama. Ipak, iz praktičnih razloga prepoznavanja simbola, prvavitičasta zagrada je sastavni dio drugih struktura. Iza svake naredbe unutar bloka se nalazi simbol tačka-zarez (;). Program sesastoji od vitičaste zagrade i jednog bloka. To se može predstaviti sintaksnim dijagramima na slikama Sl. 5.2.1 i Sl. 5.2.2.

Program:

Sl. 5.2.1. ProgramBlok

Sl. 5.2.2. BlokPseudokod za realizaciju bloka izgleda kao na slici Sl. 5.2.3

Sl. 5.2.3. Pseudokod, relizacija blokova

5.3. Modifikacije procedura kompajlera zbog prevođenja iz datoteke

Procedura Novi treba da sada čita znakove iz ulazne datoteke, ignorišući blankove kao i neprintabilne znakove(ASCII <32) i nove redove. Stoga je ona sada složenija. U pseudokodu procedura Novi izgleda ovako:

Sl. 5.3.1. Pseudokod, procedura Novi

Izraz ; }

{ Blok

Sve dok ne slijedi “}” izvrši Izraz i pokupi simbol “;”Pokupi simbol “}”

Početak sekvenceUvećaj pokazivač unutar linije za 1

Ako je pokazivač prešao kraj linije Uvećaj brojač linija za 1, učitaj novu liniju sdiska i pokazivač postavi na 1

Varijabli znak dodijeli slovo linije na poziciji pokazivača. Ako je linija prazna,dodijeli varijabli znak blanko

Ponavljaj sve dok je znak blanko ili neprintabilan, a nije kraj ulazne datoteke

Page 16: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

16

Procedura IdiDo ima kao argument karakter. Ona treba da prijavi grešku ukoliko znak koji slijedi iz ulazne datotekenije onaj koji je naveden kao argument ove procedure.

Procedura Greska čiji je argument string, prikazuje tekst greške na ekranu, zatvara datoteke i prekida izvršenjekompajlera. Ovo može zvučati prilično nepraktično, jer ovako dizajnirani kompajler prevodi samo do prve greške. Sadanašnjim računarima i interaktivnim radom to ne mora biti problem, što dokazuje uspjeh Turbo Pascala koji je sve do svojedesete verzije (Delphi 2) potpuno zanemarivao oporavak od grešaka. Oporavak od grešaka zahtijeva dosta dodatnog koda štosmanjuje razumljivost rada kompajlera.

Procedura Emit se nije mnogo izmijenila. Umjesto na ekran, izlaz se šalje u izlaznu datoteku.

5.4. Modifikacije kompajlera zbog generisanja datoteka sa asemblerskim kodom

Nije dovoljno samo prevedene aritmetičke izraze usmjeriti u datoteku. Dobijeni asemblerski program treba prevestinekim 32-bitnim asemblerom, kakvi su MASM, TASM ili NASM. Osim toga, mora postojati i određeni kôd da se programuspješno završi i vrati kontrolu operativnom sistemu. U programerskom žargonu taj dio koda se zove entry stub ili ulazni kôdi on izgleda kao na slici Sl. 5.4.1 . U suštini je ovim rečeno asembleru da generiše 32 bitni mašinski program, prilagođenWindows operativnom sistemu. Nakon generisanog programa se nalazi poziv rutine za završetak procesa i rezervisano mjestoza 26 varijabli.

Sl. 5.4.1. Entry stub – standardni asemblerski ulazni kôdProcedura Prevedi emituje ovaj ulazni kôd i poziva proceduru Blok. Procedura Prevedi se poziva iz procedure

Glavni, koja otvara ulaznu i izlaznu datoteku. Imena ovih datoteka se navode kao argumenti komandne linije prilikom pozivakompajlera koristeći, npr.:

KOMP32V2 PRIMJER.JEZ PRIMJER.ASM

Iako većina današnjih programa koristi menije umjesto komandne linije, zbog kratkoće programa i koncentracije naproces kompajliranja a ne na korisnički interfejs, ovaj kompajler je realizovan u formi komande iz komandne linije.

5.5. Proširenja aritmeti čkih izraza

Napravljene su određene izmjene i u samim aritmetičkim izrazima. Najvažnije je što numeričkekonstante nisu više jednocifrene. Dohvatanje konstante se može izvesti algoritmom sa slike Sl. 5.5.1

Sl. 5.5.1. Promijenjeni algoritam za dohvatanje konstanteLako je dodati operaciju ostatka pri dijeljenju koja se, u skladu sa konvencijom iz C-a, označava znakom % .

Dovoljno je obaviti operaciju dijeljenja i nakon nje izvršiti jedno

MOV AX,DX

Uzmi konstantuRezultat postavi na 0

Sve dok je znak koji slijedi između 0 i 9 rezultat postavi na

10 * rezultat + vrijednost cifre znaka, pa uzmi novi znakAko je znak blanko dohvati novi

.386

.MODEL FLAT,STDCALL

OPTION CASEMAP:NONE

EXTRN ExitProcess@4:NEAR

.CODE

ULAZ:

JMP GLAVNI

GLAVNI:

.....

generisani program

.....

PUSH 0

CALL ExitProcess@4

.DATA

GLOBALV DD 26 DUP(0)

END ULAZ

Page 17: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

17U skladu sa uvođenjem operacije ostatka pri dijeljenju mijenja se sintaksa jezičkog pojma član i ona sada izgleda kao na sliciSl. 5.5.2. Nema potrebe pisati pseudokod, jer je modifikacija odgovarajuće procedure član trivijalna.

Član

Sl. 5.5.2. ČlanJezički pojam Faktor (čija je nova verzija prikazana na slici Sl. 5.5.3) i odgovarajuća procedura proširuju se unarnimminusom. Implementacija unarnog minusa rekurzivno poziva Faktor , a nakon tog pozva dodaje se naredba NEG EAX .

Faktor:

Sl. 5.5.3. FaktorU prilogu 2 na kraju rada dat je listing druge verzije kompajlera. Tamnijom bojom slova su označene izmjene u odnosu naprvu verziju.

5.6. Testni primjer

Na slici Sl. 5.6.1 primjer malog programa. Treba kreirati datoteku ulaz2.jez sa sljedećim sadržajem:

{

2+3*8;

6*8*(4-2);

}

Sl. 5.6.1. Primjer za testiranje prve verzije kompajleraIza zadnje vitičaste zagrade potrebno je preći u novi red. Nakon kompajliranja ovog primjera sa

KOMP32V2 ULAZ2.JEZ ULAZ2.ASMdobije se asemblerski listing prikazan na slici Sl. 5.6.2:

.386

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: JMP GLAVNI;{; 2+3*8;GLAVNI: MOV EAX,2 PUSH EAX MOV EAX,3 PUSH EAX

MOV EAX,8 POP EBX IMUL EBX POP EBX ADD EAX,EBX; 6*8*(4-2); MOV EAX,6 PUSH EAX MOV EAX,8 POP EBX IMUL EBX PUSH EAX MOV EAX,4 PUSH EAX

MOV EAX,2 MOV EBX,EAX POP EAX SUB EAX,EBX POP EBX IMUL EBX;};} PUSH 0 CALL [email protected] DD 26 DUP(0)END ULAZ

Sl. 5.6.2. Asemblerski listing dobijen kompajleromPrilikom generisanja listinga dodano je da se linija izvornog koda šalje u asemblerski program kao komentar. Iza te

linije obično slijede asemblerske linije koje implementiraju navedenu liniju koda u višem programskom jeziku. Asemblerskilisting još uvijek nije pravi mašinski program. Da bi se on preveo u mašinski program, treba pokrenuti asembler, na primjerMicrosoftov MASM 6.14 komandom

ml /c /coff /Fl ulaz2.asm

Faktor

/

* Faktor

%

( Izraz )

Numerička konstanta

- Faktor

Page 18: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

18što znači da se prevodi bez linkovanja u Common object file format (coff) uz generisanje listinga. Kao rezultat ovog

asembliranja dobijaju se datoteke ulaz2.obj i ulaz2.lst. Datoteku u OBJ formatu sada treba povezati sa drugim takvimdatotekama ili bibliotekama rutina koje se nalaze u LIB datotekama. To se radi programom koji se zove linker. Kao primjeruzima se Microsoftov LINK 5.12 i pokreće sa

link /defaultlib:kernel32.lib /subsystem:console ulaz2.objOvo znači da se ulaz2.obj povezuje sa bibliotekom funkcija kernel32.lib praveći ulaz2.exe Program ULAZ2.EXE

može se pokrenuti, neće pasti, nego se samo uspješno završava ne prikazujući ništa na ekranu. To je i za očekivati, pošto serezultati izraza samo smještaju u AX po njihovom izvršenju. Program bi se eventualno mogao pratiti korak po korak koristećidebager.

Na slici Sl. 5.6.3 dati su izgled LST datoteke koja daje heksadekadni prikaz generisanog mašinskog koda uzodgovarajući asemblerski kôd, izgled objektne (OBJ) te izvršne (EXE) datoteke. Mnogi kompajleri direktno prevode uobjektnu ili izvršnu datoteku. Formati OBJ i EXE datoteka su, međutim, dosta složeni, nepregledni i glomazni i njihov opis jeizvan opsega ovog rada. No, poredeći prevedeni kôd u LST datoteci i posebno označene bajtove u OBJ i EXE datotekama naslici Sl. 5.6.3 prepoznaje se da je program korektno preveden u mašinski jezik. Ostatak datoteke OBJ sadrži tabele zarelociranje u slučaju spajanja različitih modula. EXE datoteka, pored mašinskog koda testnog programa, sadrži i dio koda kojisprječava izvršavanje programa pod 16-bitnim MS DOS-om, spisak dinamičkih biblioteka i rutina iz njih koje se uvezuju sakorisničkim programom te relokacione tabele

.

Sl. 5.6.3. Izgled OBJ, LST i EXE datoteka

Turbo Dump Version 5.0.16.4 Copyright (c) 1988, 1998 Borland International Display of File ULAZ2.OBJ

000000: 4C 01 03 00 36 5F 84 3D 4C 01 00 00 0B 00 00 00 L...6_.=L.......000010: 00 00 00 00 2E 74 65 78 74 00 00 00 00 00 00 00 .....text.......000020: 00 00 00 00 42 00 00 00 8C 00 00 00 CE 00 00 00 ....B...........000030: 00 00 00 00 01 00 00 00 20 00 30 60 2E 64 61 74 ........ .0`.dat000040: 61 00 00 00 42 00 00 00 00 00 00 00 68 00 00 00 a...B.......h...000050: D8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000060: 40 00 30 C0 2E 64 72 65 63 74 76 65 AA 00 00 00 @.0..drectve....000070: 00 00 00 00 0C 00 00 00 40 01 00 00 00 00 00 00 [email protected]: 00 00 00 00 00 00 00 00 00 0A 00 00 EB 00 B8 02 ................000090: 00 00 00 50 B8 03 00 00 00 50 B8 08 00 00 00 5B ...P.....P.....[0000A0: F7 EB 5B 03 C3 B8 06 00 00 00 50 B8 08 00 00 00 ..[.......P.....0000B0: 5B F7 EB 50 B8 04 00 00 00 50 B8 02 00 00 00 8B [..P.....P......0000C0: D8 58 2B C3 5B F7 EB 6A 00 E8 00 00 00 00 3E 00 .X+.[..j......>.0000D0: 00 00 07 00 00 00 14 00 00 00 00 00 00 00 00 00 ................0000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000140: 2D 65 6E 74 72 79 3A 55 4C 41 5A 20 2E 66 69 6C -entry:ULAZ .fil000150: 65 00 00 00 00 00 00 00 FE FF 00 00 67 01 75 6C e...........g.ul000160: 61 7A 32 2E 61 73 6D 00 00 00 00 00 00 00 00 00 az2.asm.........000170: 40 63 6F 6D 70 2E 69 64 FC 20 12 00 FF FF 00 00 @comp.id. ......000180: 03 00 2E 74 65 78 74 00 00 00 00 00 00 00 01 00 ...text.........000190: 00 00 03 01 42 00 00 00 01 00 00 00 00 00 00 00 ....B...........0001A0: 00 00 00 00 00 00 2E 64 61 74 61 00 00 00 00 00 .......data.....0001B0: 00 00 02 00 00 00 03 01 68 00 00 00 00 00 00 00 ........h.......0001C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 ................0001D0: 00 00 00 00 00 00 00 00 20 00 02 00 5F 55 4C 41 ........ ..._ULA0001E0: 5A 00 00 00 00 00 00 00 01 00 20 00 02 00 2E 64 Z......... ....d0001F0: 72 65 63 74 76 65 00 00 00 00 03 00 00 00 03 01 rectve..........000200: 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000210: 00 00 13 00 00 00 5F 45 78 69 74 50 72 6F 63 65 ......_ExitProce000220: 73 73 40 34 00 00 00 00 00 00 00 00 00 00 00 00 ss@4............

Turbo Dump Version 5.0.16.4 Copyright (c) 1988, 1998 BorlandInternational Display of File ULAZ2.EXE

000000: 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00 MZ..............000010: B8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 [email protected]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000030: 00 00 00 00 00 00 00 00 00 00 00 00 B0 00 00 00 ................000040: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 ........!..L.!Th000050: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F is program canno000060: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 t be run in DOS000070: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 00 mode....$.......000080: 5D 17 1D DB 19 76 73 88 19 76 73 88 19 76 73 88 ]....vs..vs..vs.000090: 19 76 73 88 1D 76 73 88 E5 56 61 88 18 76 73 88 .vs..vs..Va..vs.0000A0: 52 69 63 68 19 76 73 88 00 00 00 00 00 00 00 00 Rich.vs.........0000B0: 50 45 00 00 4C 01 03 00 38 5F 84 3D 00 00 00 00 PE..L...8_.=....0000C0: 00 00 00 00 E0 00 0F 01 0B 01 05 0C 00 02 00 00 ................0000D0: 00 04 00 00 00 00 00 00 00 10 00 00 00 10 00 00 ................0000E0: 00 20 00 00 00 00 40 00 00 10 00 00 00 02 00 00 . [email protected]: 04 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ................000100: 00 40 00 00 00 04 00 00 00 00 00 00 03 00 00 00 [email protected]: 00 00 10 00 00 10 00 00 00 00 10 00 00 10 00 00 ................000120: 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 ................000130: 08 20 00 00 28 00 00 00 00 00 00 00 00 00 00 00 . ..(...........000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000180: 00 00 00 00 00 00 00 00 00 20 00 00 08 00 00 00 ......... ......000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0001A0: 00 00 00 00 00 00 00 00 2E 74 65 78 74 00 00 00 .........text...0001B0: 48 00 00 00 00 10 00 00 00 02 00 00 00 04 00 00 H...............0001C0: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 60 ............ ..`0001D0: 2E 72 64 61 74 61 00 00 54 00 00 00 00 20 00 00 .rdata..T.... ..0001E0: 00 02 00 00 00 06 00 00 00 00 00 00 00 00 00 00 ................0001F0: 00 00 00 00 40 00 00 40 2E 64 61 74 61 00 00 00 ....@[email protected]: 68 00 00 00 00 30 00 00 00 02 00 00 00 08 00 00 h....0..........000210: 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 C0 [email protected]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0002A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0002B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0002C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0002D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0002E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0002F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0003A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0003B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0003C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0003d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0003E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0003F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000400: EB 00 B8 02 00 00 00 50 B8 03 00 00 00 50 B8 08 .......P.....P..000410: 00 00 00 5B F7 EB 5B 03 C3 B8 06 00 00 00 50 B8 ...[..[.......P.000420: 08 00 00 00 5B F7 EB 50 B8 04 00 00 00 50 B8 02 ....[..P.....P..000430: 00 00 00 8B D8 58 2B C3 5B F7 EB 6A 00 E8 00 00 .....X+.[..j....000440: 00 00 FF 25 00 20 40 00 00 00 00 00 00 00 00 00 ...%. @.........000450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................................................................0005D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0005E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0005F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000600: 38 20 00 00 00 00 00 00 30 20 00 00 00 00 00 00 8 ......0 ......000610: 00 00 00 00 46 20 00 00 00 20 00 00 00 00 00 00 ....F ... ......000620: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000630: 38 20 00 00 00 00 00 00 75 00 45 78 69 74 50 72 8 ......u.ExitPr000640: 6F 63 65 73 73 00 4B 45 52 4E 45 4C 33 32 2E 64 ocess.KERNEL32.d000650: 6C 6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ll..............000660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................000680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .......................................................................0009D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0009E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0009F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Microsoft (R) Macro Assembler Version 6.14.844409/15/02 12:21:42ulaz2.asm

Page 1 - 1

.386

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN

ExitProcess@4:NEAR 00000000 .CODE 00000000 ULAZ: 00000000 EB 00 JMP GLAVNI

;{; 2+3*8;

00000002 GLAVNI: 00000002 B8 00000002 MOV EAX,2 00000007 50 PUSH EAX 00000008 B8 00000003 MOV EAX,3 0000000D 50 PUSH EAX 0000000E B8 00000008 MOV EAX,8 00000013 5B POP EBX 00000014 F7 EB IMUL EBX 00000016 5B POP EBX 00000017 03 C3 ADD EAX,EBX

; 6*8*(4-2); 00000019 B8 00000006 MOV EAX,6 0000001E 50 PUSH EAX 0000001F B8 00000008 MOV EAX,8 00000024 5B POP EBX 00000025 F7 EB IMUL EBX 00000027 50 PUSH EAX 00000028 B8 00000004 MOV EAX,4 0000002D 50 PUSH EAX 0000002E B8 00000002 MOV EAX,2 00000033 8B D8 MOV EBX,EAX 00000035 58 POP EAX 00000036 2B C3 SUB EAX,EBX 00000038 5B POP EBX 00000039 F7 EB IMUL EBX

;};}

0000003B 6A 00 PUSH 0 0000003D E8 00000000 E CALL ExitProcess@4 00000000 .DATA 00000000 0000001A [ GLOBALV DD 26 DUP(0)

00000000 ]

END ULAZ

Page 19: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

195.7. Rezime poglavlja

Format pisanja instrukcija u jeziku koji se razvija u ovom radu je slobodni, a od ove verzije kompajlera moguće jeprevoditi iz datoteke u datoteku. Program se više ne sastoji od jednog aritmetičkog izraza, već od bloka naredbi. Novi načinprevođenja zahtijeva modifikaciju procedura Novi i Emit , a uvode se procedure IdiDo i Greska. Asemblerski programizahtijevaju određeni kôd koji se zove Entry stub, pa kompajler generiše i njega. Da bi aritmetički izrazi radili sa višecifrenimbrojevima modifikovano je dohvatanje konstante. Dodavanje unarnog minusa i ostatka pri dijeljenju zahtijeva promjenuprocedura Faktor i Clan. Iz testnog primjera uspješno se generiše asemblerski listing, a iz asemblerskog listinga se dobijajuobjektni i izvršni kôd.

Prilog 2: Verzija izvornog koda kompajlera br. 2

program Kompajler;const OCEKIVANO = 'Ocekivano '; GRIZRAZ = 'Izraz';var ulaz, izlaz: text; pozicija, brojaclinija: integer; znak: char; linija: string;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; until (znak > ' ') or Eof(ulaz)end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); Novi; end; if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat;end;

procedure Izraz; forward;

procedure Faktor;var rezultat: integer; st: string;begin case znak of '-': begin Novi; Faktor; Emit(' NEG EAX'); end; '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; Izraz; IdiDo(')'); end; else Greska(GRIZRAZ); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-']) do begin Emit(' PUSH EAX'); z := znak;

Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; end; end;end;

procedure Blok;begin while znak <> '}' do begin Izraz; IdiDo(';'); end; IdiDo('}');end;

procedure Prevedi;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; Novi; IdiDo('{'); Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Emit('GLOBALV DD 26 DUP(0)'); Emit('END ULAZ')end;

procedure Glavni;var linija: string;begin Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 20: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

20

6. VARIJABLE, RELACIONI OPERATORI, USLOVI, PETLJE

Iako sposobna da generiše asemblerski kod, prethodna verzija kompajlera još uvijek ne liči na prevodilac pravogprogramskog jezika jer nedostaju dvije izuzetno bitne stvari, mogućnost smještanja međurezultata u varijable i mogućnostgrananja programa. Stoga je potrebno uvesti elementarne kontrolne strukture, varijable i proširiti aritmetičke izraze.

6.1. Proširenje aritmetičkih izraza

Aritmetički izraz se proširuje relacionim operatorima, operatorom dodjeljivanja, te unarnim operatorima. Za razlikuod Pascala, na primjer, dodjeljivanje nije poseban iskaz, nego sastavni dio aritmetičkog izraza (kao u C-u), te je pogodnije zaovu koncepciju razvoja programskog jezika, koja kreće od koncepta izraza.

Operator dodjeljivanja će, privremeno, biti dvotačka “:”. Primjer

a:b:c:2;

dodjeljuje varijabli c vrijednost 2, zatim se varijabla c dodjeli varijabli b, pa varijabla b varijabli a.

Ovaj primjer dovodi do pojma lijeve i desne asocijativnosti operatora. Taj pojam odgovara na pitanje koji operandi seprvi računaju kada je prioritet više upotrijebljenih operatora jednak. Za sabiranje, oduzimanje, množenje i dijeljenje korištenaje lijeva asocijativnost. Npr. 3+2-4 će prvo izračunati 3, njemu dodati 2 a zatim od toga oduzeti 4.

Dodjeljivanje je desno asocijativno, što se vidi iz gore navedenog primjera. Već je u prvoj fazi pokazano da seponavljanje lijevo asocijativnih operatora realizuju while petljom. Suprotno tome, ponavljanje desno asocijativnih operatorarealizuje se rekurzijom unutar obrade desnog operanda.

Relacioni operatori su =,>,< i # (različito). Rezultat poređenja dva izraza može biti 0 ako je relacija netačna ili 1 akoje tačna. Ovi operatori nisu asocijativni, jer bi to dovelo do zbunjujućih situacija. Npr. izraz 3>2>1 u matematici je tačan ipredstavlja činjenicu da je broj 2 veći od 1 a manji od 3, ali u kontekstu izraza u računaru ima sasvim drugu semantiku. Izraz3>2 daje vrijednost 1, a zatim se ta vrijednost 1 poredi da li je veća od 1, što nije tačno, pa cijeli izraz vraća vrijednost 0. Poštotakva semantika nije mnogo korisna, neće biti realizovana.

Operatori dodjeljivanja i relacioni operatori trebaju da imaju najniži prioritet. To znači da se mora definisati novijezički pojam Izraz dodjeljivanja .

Izraz dodjeljivanja

Sl. 6.1.1. Izraz dodjeljivanjaNa dijagramu sa slike Sl. 6.1.1 se vidi da neasocijativni operatori (relacioni) sa desne strane imaju pojam Izraz dok se

za desno asocijativni operator dodjeljivanja sa desne strane nalazi pojam Izraz dodjeljivanja.

Za realizaciju poređenja pomaže instrukcija SETcc AL, gdje cc predstavlja uslov koji predstavlja testiranje flegova,obično vezano za rezultat prethodne instrukcije. Ova instrukcija postavlja AL na 1 ako je uslov ispunjen odnosno na 0 ako nije,upravo ono što treba, bez korištenja uslovnih skokova. Generisani kôd za relacione operatore izgleda kao na slici Sl. 6.1.2

Sl. 6.1.2. Generisani kôd za relacione operatore

Pozovi Izraz

PUSH EAX

Pozovi IzrazPOP EBX

CMP EBX,EAX

SETE AL ili SETG AL ili SETL AL ili SETNE AL (respektivno na =,>,<,#)AND EAX,0FFh

Izraz

Izrazdodjeljivanja

Izraz

>

<

=

#

:

Page 21: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

21Dakle, analogno operaciji sabiranja, prvi operand se dobija u EBX, a drugi u EAX registru, a poređenje se vrši

CMP EBX,EAX instrukcijom. Rezultat poređenja se dobije u fleg registru, a zatim se odgovarajućom SETE, SETG, SETL iliSETNE instrukcijom postavlja AL registar na željenu vrijednost. Pošto preostala tri bajta registra EAX mogu imati slučajnuvrijednost, posljednjom AND EAX,0FFh se oni postavljaju na nule.

Kod dodjeljivanja, međutim, nije potrebna vrijednost prvog operanda, nego njegova adresa. Uzima se da se ovaadresa nalazi u EBX registru. To je dovoljno generalno rješenje, jer se vrijednost ne dodjeljuje samo varijablama, nego i nekimizrazima (npr. onim koji su rezultati pointerskih operacija). Vrijednost drugog operanda se nalazi u EAX registru. Stoga jegenerisani kôd za ovu operaciju oblika prikazanog na slici Sl. 6.1.3.

Sl. 6.1.3. Generisani kôd za operator dodjeljivanjaU ovoj fazi se još uvijek jednostavnost kompajlera drži u prvom planu. Stoga, imena varijabli, koje se upravo uvode,

su jednoslovna i to predstavljena malim slovima. To, u ovom trenutku, ukida potrebu za tabelom imena varijabli ipretraživanjem iste. Umjesto toga, svih 26 varijabli se može držati u statički alociranom prostoru.

Statički alociran prostor je deklarisan kao GLOBALV DD 26 DUP(0). Ovo znači da će svaka varijabla zauzimati po 4bajta.

Sl. 6.1.4. Organizacija prostora za globalne varijable

Pogledom na sliku Sl. 6.1.4, uočava se da ako se od ASCII koda imena varijable oduzme ASCII kôd slova 'a' i rezultatpomnoži sa 4, dobije se relativni pomak u odnosu na labelu GLOBALV a time i adresa tražene varijable.

Nad varijablom se mogu obavljati dvije funkcije. Ona se može čitati, ali joj se može i dodijeliti vrijednost. Stoga jepotrebno da nakon pristupa varijabli registar EBX ima njenu adresu, a registar EAX njenu vrijednost. Dosljedno dosadašnjemradu, vrijednost varijable c se može dobiti koristeći

LEA EBX,GLOBALV[8]

MOV EAX,[EBX]Da bi se uvele varijable potrebna je izmjena jezičkog pojma Faktor. Pored varijabli, u ovoj verziji kompajlera uvode

se i novi unarni operatori. Svi oni se realizuju na isti način kao unarni minus uveden u prethodnoj verziji kompajlera, daklerekurzivnim pozivom procedure Faktor, a zatim generisanjem koda koji modifikuje registar EAX. Unarni operatori sunavedeni u tabeli na slici Sl. 6.1.5:

Oznaka operatora Značenje operatora Instrukcije koje se generišu nakonpoziva procedure Faktor

- Aritmetički unarni minus. Promjena predznaka registra EAX NEG EAX

~ Binarna negacija. Pretvaranje svih nula u jedinice a svih jedinica u nuleunutar binarnog zapisa registra EAX

NOT EAX

& Adresa operanda. Vraća adresu izraza koji slijedi (tipično varijabla) MOV EAX,EBX

* Pointer/pokazivač. Vraća cijeli broj koji se nalazi na adresi koja se dobijeračunom izraza

MOV EBX,EAX

MOV EAX,[EBX]

! Logička negacija. Ako je EAX jednak 0 on dobija vrijednost 1, inačedobija vrijednost 0

CMP EAX,0

SETE AL

AND EAX,0FFh

Sl. 6.1.5. Unarni operatori

GLOBALV[0]- GLOBALV[3]Varijabla a

GLOBALV[4]-GLOBALV[7]Varijabla b

GLOBALV[8]...Varijabla c

Izvrši Izraz

PUSH EBX

Izvrši Izraz dodjeljivanjaPOP EBX

MOV [EBX],EAX

Page 22: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

22Uvođenje unarnih operatora zahtijeva da se promijene sintaksni dijagram za jezički pojam Faktor i odgovarajuća

procedura za implementaciju tog jezičkog pojma. Realizacija te procedure data je u okviru listinga u prilozima.

Faktor:

Sl. 6.1.6. FaktorUz dodatak relacionim operatorima, zgodno je uključiti i operatore konjunkcije, disjunkcije i ekskluzivne disjunkcije.

Iz C-a se preuzimaju operatori & ,| i ^ koji vrše operacije bit po bit, pa su oni upotrebljivi i za maskiranja bitova. Kako su svetri operacije komutativne, realizacija je analogna sabiranju, sa kojim se dijeli i prioritet operacije. U tu svrhu se jezički pojamIzraz modifikuje da izgleda kao na slici Sl. 6.1.7.

Sl. 6.1.7. IzrazLogičke operacije se prevode u kôd sa slike Sl. 6.1.8:

Sl. 6.1.8. Generisani kôd za logičke operacijePošto se ne dodaje novi operator prioriteta množenja i dijeljenja, procedura Clan se ne mijenja.

6.2. Uslovi

Za realizovanje programskih struktura uslova i petlje, potrebno je koristiti skokove u asemblerskom jeziku. U ovojoblasti je generisanje asemblerskog programa jednostavnije od generisanja mašinskog programa, pogotovo kada su u pitanjuskokovi unaprijed. To omogućavaju labele. Labele u generisanom listingu imaju oblik L1, L2, L3..., pri čemu je broj iza slova

( Izrazdodjeljivanja

)

Numeričkakonstanta

Faktor

*

&

~

!

-

Varijabla

Član

+

-

Član&

|

^

Pozovi Član

PUSH EAX

Pozovi ČlanPOP EBX

AND EAX,EBX ili OR EAX,EBX ili XOR EAX,EBX

Page 23: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

23L smješten u cjelobrojnu globalnu varijablu TrenLabela. Procedurom NovaLabela se taj broj uveća za 1 i zatim vrati u formistringa.

Uslov se može predstaviti sintaksnim dijagramom sa slike Sl. 6.2.1

Uslov:

Sl. 6.2.1. Uslov

Jezik još nema ključnih riječi, pa se uslov označava znakom ?, zatim slijedi izraz koji treba da vrati vrijednost 0 ili 1,pa otvorena vitičasta zagrada i blok koji označavaju sekciju koja se izvršava ako je uslov ispunjen. Prethodni znak “?” jeprikazan isprekidanim linijama u sintaksnom dijagramu jer se ne prepoznaje u proceduri Uslov koja implementira uslove negou proceduri Blok. Na kraju jezičkog pojma Uslov nalazi se druga otvorena vitičasta zagrada i sekcija koja se izvršava akouslov nije ispunjen.

Sl. 6.2.2. Primjer uslova, treća verzija kompajleraNa slici Sl. 6.2.2 dat je primjer uslova koji radi sljedeće: Ako je varijabla a jednaka 3 i varijabla n veća od 8, varijabli

b se dodjeljuje vrijednost 8, a varijabli c vrijednost 2. Ako bar jedan od gornjih uslova nije ispunjen, varijabla b dobijavrijednost 12.

Uslov se smatra ispunjenim ako je rezultat izraza koji se ispituje različit od nule. Izraz ima rezultat u EAX registru.Stoga se uslov može realizovati kodom sa slike Sl. 6.2.3. Na slici se vidi da je potrebno generisati tri nove labele. Ovdje su oneoznačene sa Londa, Linace i Lkrajuslova, a u praksi mogu biti, na primjer, L11, L12 i L13.

Instrukcija CMP EAX,0 postavlja Z fleg na 1 ako je u EAX registru nula, a u protivnom Z fleg se postavi na 0. Stogainstrukcija JNE Londa izaziva skok na labelu Londa ako je EAX=0, a u protivnom se izvrši sljedeća instrukcija koja jebezuslovni skok na labelu Linace. Na kraju bloka koji se izvršava kada je uslov ispunjen, nalazi se skok na labelu Lkrajuslovada bi se preskočila sekcija koja se ne izvršava.

Sl. 6.2.3. Generisani kôd za realizaciju uslova

6.3. Petlje

Iako konceptualno složenije od uslova petlje su za realizaciju još jednostavnije. Kao sintaksni simbol petlje uzima seznak & , čije druge dvije upotrebe za adresu varijable i binarnu konjunkciju neće praviti konfuziju jer nema smisla da se u tomkontekstu nalaze na početku naredbe. Petlja se predstavlja sintaksnim dijagramom sa slike Sl. 6.3.1.

? Izrazdodjeljivanja

{ Blok { Blok

? (a=3 & n>8)

{ b:8;

c:2;

} {

b:12;

}

Pozovi Izraz dodjeljivanja

CMP EAX,0

JNE LondaJMP Linace

Londa: Pozovi Blok

JMP LkrajuslovaLinace: Pozovi Blok

Lkrajuslova: ....

Page 24: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

24Petlja:

Sl. 6.3.1. PetljaPrimjer

& a<0 { a:a+1}

sve dok je a manje od nula, uvećavaj varijablu a za 1.

Petlja se može realizovati generisanim kodom kao na slici Sl. 6.3.2.

Sl. 6.3.2. Generisanje koda za petljeSa ovim tipom petlje (odgovara while petlji) mogu se realizovati i programi koji zahtijevaju ostala dva popularna tipa

petlji (for i do/repeat).

Programskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog sistema i ne može serealizovati bez asemblerskih potprograma ili poziva sistemskih procedura. Stoga se uvodi specijalni simbol \ , koji predstavljada od sljedeće linije slijedi asemblerski kôd Nakon ovoga, kompajler jednostavno prepisuje naredne linije u generisaniasemblerski kôd, sve dok se ne dođe do linije koja počinje znakom \.

Sintaksni dijagram za asemblersku sekvencu se neće navoditi, jer je asemblerski jezik linijski orijentisan.

6.4. Generalizovani jezički pojam blok

Jezički pojam Blok, i s njim vezana odgovarajuća procedura se sada mora redizajnirati da uključi uslove, petlje,asembler i izraz dodjeljivanja, kao na slici Sl. 6.4.1

Blok:

Sl. 6.4.1. Jezički pojam blok

To u realizaciji znači da procedura Blok treba da prepozna odgovarajući simbol i ovisno o njemu pozoveodgovarajuću proceduru.

Sada se može realizovati listing treće verzije kompajlera, pod imenom komp32v3, koji je naveden u prilogu 3.Izmjene u odnosu na drugu verziju prikazane su tamnijim slovima.

&Izrazdodjeljivanja

{ Blok

Luslov:Pozovi Izraz dodjeljivanja

CMP EAX,0

JNE LdokJMP Lkrajpetlje

Ldok: Pozovi Blok

JMP LuslovLkrajpetlje: ....

&

?

\ Asembler

Izraz dodjeljivanja

Uslov

Petlja

}

;

Page 25: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

256.5. Testni primjer

Kao primjer programa u ovoj verziji jezika uzeće se traženje kvadratnog korijena cijelog broja Heronovim algoritmom.Koristeći Heronov algoritam, program će naći cijeli dio korijena broja iz varijable n, pazeći da ne dođe do dijeljenja s nulom ilivađenja korijena negativnog broja, a zatim emitovati zvučni signal onoliko puta koliki je rezultat. Zvučni signal se generišeasemblerskim pozivom sistemske funkcije MessageBeep@4, koja se nalazi u biblioteci USER32.DLL, pri čemu se prije pozivamora na stek staviti broj -1.

Treba unijeti sljedeći kôd sa slike Sl. 6.5.1 i snimiti ga pod imenom heron.jez

{

n:200;

a:n;

b:1;

& (b<10)

{

? (a>0)

{

a:(a+n/a)/2;

b:b+1;

}

{

a:0;

}

}

q:a;

& q>0

{

\

extrn MessageBeep@4:near

PUSH -1

CALL MessageBeep@4

\

q:q-1;

}

}

Sl. 6.5.1. Traženje kvadratnog korijena Heronovim algoritmom

Nakon naredbi

komp32v3 heron.jez heron.asmml /c /coff /Fl heron.asm | more

link /defaultlib:user32.lib kernel32.lib /subsystem:console heron.obj

i startanja prevedenog programa, zvučni signal se čuje 14 puta što je približno korijen iz 200.

6.6. Rezime poglavlja

U trećoj verziji jezika aritmetički izrazi su prošireni relacionim i unarnim operatorima. Varijable su statički alociranerelativno od labele GLOBALV i njihova adresa se izračunava iz ASCII koda jednoslovnog imena varijable. Uslovi i petlje seoznačavaju simbolima ? i & . Moguće je uključivati asemblerske instrukcije. U ovoj verziji jezika moguće je pisati primjere izoblasti cjelobrojne numeričke analize.

Prilog 3: Verzija izvornog koda kompajlera br. 3

program Kompajler;const OCEKIVANO = 'Ocekivano '; GRIZRAZ = 'Izraz';

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija: integer; znak: char; linija: string;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin

WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; until (znak > ' ') or Eof(ulaz)end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); Novi; end; if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat;end;

procedure IzrazDodjeljivanja; forward;procedure Blok; forward;

procedure Varijabla;var rezultat: integer; st: string;begin rezultat := (ord(znak) - ord('a')) * 4; Str(rezultat, st); Emit( ' LEA EBX,GLOBALV[' + st + ']'); Emit(' MOV EAX,[EBX]');

Page 26: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

26 Novi;end;

procedure Faktor;var rezultat: integer; st: string;begin case znak of '-': begin Novi; Faktor; Emit(' NEG EAX'); end; '~': begin Novi; Faktor; Emit(' NOT EAX'); end; '&': begin Novi; Faktor; Emit(' MOV EAX,EBX'); end; '*': begin Novi; Faktor; Emit(' MOV EBX,EAX'); Emit(' MOV EAX,[EBX]'); end; '!': begin Novi; Faktor; Emit(' CMP EAX,0'); Emit(' SETE AL'); Emit(' AND EAX,0FFh'); end; '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; IzrazDodjeljivanja; IdiDo(')'); end; 'a'..'z': Varijabla else Greska(GRIZRAZ); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

procedure Izraz;var z: char;begin

Clan; while (znak in ['+', '-', '&', '|', '^']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; '&': begin Emit(' POP EBX'); Emit(' AND EAX,EBX'); end; '|': begin Emit(' POP EBX'); Emit(' OR EAX,EBX'); end; '^': begin Emit(' POP EBX'); Emit(' XOR EAX,EBX'); end; end; end;end;

procedure IzrazDodjeljivanja;var z: char;begin Izraz; case znak of ':': begin Emit(' PUSH EBX'); Novi; IzrazDodjeljivanja; Emit(' POP EBX'); Emit(' MOV [EBX],EAX'); end; {:} '=', '>', '<', '#': begin Emit(' PUSH EAX'); z := znak; Novi; Izraz; Emit(' POP EBX'); Emit(' CMP EBX,EAX'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); end; end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); IdiDo('{'); Blok; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin

repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do case znak of '&': Petlja; '?': Uslov; '\': Asembler; else begin IzrazDodjeljivanja; IdiDo(';'); end; end; IdiDo('}');end;

procedure Prevedi;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; Novi; IdiDo('{'); Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Emit('GLOBALV DD 26 DUP(0)'); Emit('END ULAZ')end;

procedure Glavni;var linija: string;begin trenlabela := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 27: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

27

7. KLJU ČNE RIJEČI, STRINGOVI, DINAMIČKI NIZOVI I FUNKCIJE

Prethodna verzija kompajlera omogućava, u kombinaciji s asemblerskim umetnutim kodom, realizaciju raznihprograma i za neke čitaoce je dovoljna, ali i dalje ima mnogo slabih tačaka. Tu je prije svega evidentan nedostatakpotprograma, jednodimenzionalnih nizova i stringova. Osim toga, jezik je veoma kriptičan i potrebno mu je dodati ključneriječi, kako bi bio razumljiviji.

7.1. Klju čne riječi

Neka se dodaju prvo ključne riječi. Jezički pojam Blok sada može izgledati kao na slici Sl. 7.1.1.

Blok:

Sl. 7.1.1. BlokZa prepoznavanje ključnih riječi postoje dva pristupa. Jedan je izrada konačnog automata koji se zove skaner ili

leksički analizator. On se zasniva na dodjeli specijalnih simbola ključnim riječima. U primjeru sa slike Sl. 7.1.1 bi trebalomodifikovati proceduru Novi da ako prepozna slovo a da provjeri da li iza njega slijedi slovo k ili s pa ako slijedi k, provjeritida li slijedi slovo o i ako su sva tri uslova ispunjena tada se vraća simbol za ako, u protivnom se vraća identifikator a, ak, iličak neki duži identifikator (akcenat, akt itd.). U slučaju da je iza slova a slijedilo slovo s analogno se provjerava da li je riječ oključnoj riječi asembler ili možda varijabli astronaut. Skanerski pristup je brži, i omogućava odvajanje prepoznavanjaključnih riječi (leksička analiza) od ostatka procesa prevođenja, te samim tim fleksibilniji kompajler. Pristup je konzistentan jerse jednom procedurom dohvataju i jednoslovni i višeslovni jezički simboli. Mana skanerskog pristupa je u relativno dugačkomkodu za ostvarenje jednostavnog zadatka, kao i činjenici da se prosti karakter tip koji prikazuje simbol koji slijedi morazamijeniti cjelobrojnim ili specijalizovanim, jer 256 znakova nije dovoljno.

Drugi pristup je pristup očekivanih uzoraka (matching) . Ovaj pristup primijenjen je u kompajleru za programski jezikSmall C. U ulaznoj liniji se provjerava da li na trenutnom mjestu u ulaznoj slijedi željeni string u cjelini. To znači da će seprovjera vršiti više puta, bila ona potrebna ili ne. Osim toga, provjera se mora realizovati posebnom procedurom umjestoprostog poređenja sa narednim simbolom, pa se malo gubi na konzistentnosti. Ali, pristup je dovoljno jednostavan da jeizabran za programski jezik razvijan u ovom radu Kako taj jezik ima vrlo malo ključnih riječi, gubitak performansi jeneznatan.

Za prepoznavanje uzorka uvodi se funkcija Slijedi. Ova funkcija ima string argument, koji predstavlja očekivanuključnu riječ, a vraća Boolean, tako da se može pozivati sa

if Slijedi('ako') then ...Algoritam koji realizuje funkciju Slijedi se radi na sljedeći način:

Ako je niz znakova na trenutnoj ulaznoj poziciji jednak stringu navedenom kao parametar, onda sevraća vrijednost tačno i postavi pokazivač pozicije iza tog niza. U protivnom se vrati vrijednost netačno.

Koristeći ovu funkciju slijedi, lako je napisati novu verziju procedure blok i na taj način uvesti ključne riječi.

7.2. Komentari i neignorisanje simbola

Strukturirani programski jezik je nezamisliv bez komentara. Programski jezici obično definišu komentare kao diokoda koji se ignoriše, pri čemu se komentar smatra dijelom koda između dva specijalna niza simbola ili od jednog simbola dokraja linije.

U ovom jeziku, komentar je predstavljen apostrofom okrenutim na desnu stranu ` . Od tog znaka, do kraja linije tekstse ignoriše. Proceduru Novi je potrebno malo modifikovati da bi dio koda između ovog simbola i kraja linije bio ignorisan.

Ponekad je potrebno dohvatiti i analizirati simbol čak i kada je on blanko, naopaki apostrof ili novi red. Naime, uprethodnoj verziji kompajlera bilo je sasvim normalno napisati

dok

ako

asemblerr

Asembler

Izraz dodjeljivanja

Uslov

Petlja

};

Page 28: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

28a:1343223;

kao i

a:134 3

22

3;što je vrlo neuobičajeno, a kada se budu uvele stringovne konstante i neprihvatljivo. Stoga se pored funkcije novi

uvodi funkcija NoviSvaki koja radi slično kao Novi, ali ne provjerava da li je riječ o blanku ili komentaru. Ova funkcija imaparametar koji govori da li će se prijavljivati greška ukoliko se, dohvaćajući simbole, došlo do kraja reda ili ne (u tom slučajukao kraj reda vraća blanko). Procedura UzmiKonstantu se sada modifikuje tako da novu cifru uzima ovom proceduromumjesto procedure Novi.

7.3. Modifikacija uslova i petlji

Pošto je nepraktično pisati uslove tako da se uvijek navodi i sekcija koja se izvrši kad je uslov ispunjen i ona kaduslov nije ispunjen, uvodi se ključna riječ inace i jezički pojam Uslov redizajnira kao na slici Sl. 7.3.1 i skladno tome semijenja odgovarajuća procedura Uslov. Time dio koda koji se izvršava kada uslov nije ispunjen postaje opcionalan.

Uslov:

Sl. 7.3.1. UslovSintaksa petlji se ne mijenja, iako je simbol & zamijenjen ključnom riječju dok. Prepoznavanje ključne riječi dok se

obavlja unutar procedure Blok.

7.4. Modifikacije aritmeti čkih izraza i uvođenje stringova

Dodjeljivanje simbolom : je takođe zbunjujuće, pa se Izraz dodjeljivanja mijenja da se umjesto znaka : ,dodjeljivanje vrši koristeći operator := . Taj se operator može, nakon što je prepoznata dvotačka, provjeravati funkcijomslijedi(':='). Izraz dodjeljivanja je prikazan na slici Sl. 7.4.1

Sl. 7.4.1. Izraz dodjeljivanja

Stringovne konstante nije teško dodati, ukoliko se preuzme koncepcija stringova iz C-a. U C-u se stringovi prenose upotprograme i dodjeljuju odgovarajućim varijablama tako što se prenosi adresa početka stringovne konstante. Da bi se znalogdje je kraj stringovne konstante, na kraju stringa se nalazi bajt sa vrijednošću 0. Stringovne konstante uokvirene sudvostrukim navodnicima.

String konstanta:

Sl. 7.4.2. String konstanta

akoIzrazdodjeljivanja

{ Blok { Blokinace

Izraz

Izrazdodjeljivanja

Izraz

>

<

=

#

:=

" karakter "

Page 29: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

29Procedura koja prevodi stringovnu konstantu koristi proceduru NoviSvaki uz zabranu prelaska u naredni red. Ona

mora generisati kôd sa slike Sl. 7.4.3

Sl. 7.4.3. Generisani kôd za stringovne konstanteIz ovoga se vidi da se mora prvo prekinuti kodni segment i reći asembleru da se ova konstanta smjesti u segment sa

podacima, kako bi se izbjeglo izvršavanje besmislenih instrukcija koje slučajno imaju isti operacioni kôd kao bajtovipredstavljeni ASCII kodovima. Nakon ovoga ponovo se navodi kodni segment i instrukcija kojom se u EAX registar donosiadresa toga stringa. Ova adresa će se kasnije moći prosljeđivati Windows API funkcijama kao argument. U specijalnomslučaju, prazan string se prevodi u Lnn DB 0.

Ideja iz jezika C o pristupu nizovima cijelih brojeva koristeći pokazivačke varijable, omogućava vrlo jednostavnododavanje jednodimenzionalnih nizova. Uz pretpostavku da varijabla sadrži adresu nekog prostora u memoriji (koji se može uovom trenutku dobiti dodjeljivanjem stringovne konstante varijabli ili pozivom Windows API funkcije GlobalAlloc uasemblerskom modulu) i ako se taj prostor iskoristi za smještanje elemenata niza, tada je dovoljno u sintaksi varijable dodatiopcionalni indeks unutar uglastih zagrada, kao što se vidi na sintaksnom dijagramu sa slike Sl. 7.4.4:

Varijabla:

Sl. 7.4.4. VarijablaAdresa elementa niza tada se može dobiti po formuli

Adresa=vrijednost varijable predstavljene slovom + 4 * vrijednost izraza dodjeljivanjaStoga se element niza dobija koristeći kôd sa slike Sl. 7.4.5.

Sl. 7.4.5. Generisani kôd za dobijanje elementa nizaInstrukcija SAL pomjera registar EAX za dva bita ulijevo, što efektivno predstavlja množenje sa 4. U skladu sa

dosadašnjim standardom, adresa elementa niza se dobija u registru EBX, a njegova vrijednost u registru EAX.

7.5. Funkcije i procedure

Pošto je jezik koji se razvija sličan C-u, gdje se kreće od izraza, a ne iskaza, dodavanje funkcija automatski rješava iproblem dodavanja procedura ili običnih potprograma. Procedure su prosto funkcije čija se vrijednost zanemaruje, a običnipotprogrami pored toga nemaju argumenata.

Poziv funkcije se vrši unutar izraza i sintaksno je prikazan na slici Sl. 7.5.1:

Sl. 7.5.1. Poziv funkcijeKao u implementaciji većine modernih programskih jezika, parametri se prije poziva funkcije smještaju na stek.

Slovo [ Izrazdodjeljivanja

]

Velikoslovo

maloslovo

Izrazdodjeljivanja

,

( )

.DATALnn db "String koji je koristen",0

.CODE

MOV EAX,OFFSET Lnn

PUSH EAX Pozovi IzrazDodjeljivanja;

POP EBX

SAL EAX,2 ADD EBX,EAX

MOV EAX,[EBX]

Page 30: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

30U definiciji funkcije se za sada ne navode parametri, iako se oni mogu navesti pri pozivu. Stoga, ova verzija

kompajlera nema provjeru broja i tipa parametara funkcija i smatraće se da sve funkcije imaju po 26 parametara.

Imajući ovo u vidu, generisani kôd za poziv funkcije izgleda kao na slici Sl. 7.5.2 :

Sl. 7.5.2. Poziv funkcije, generisani kôd

Podatak o tome koliko su memorije na steku zauzeli parametri, a koji se smješta u ECX, koristiće se u samoj funkciji.

Definicija funkcije data je na sintaksnom dijagramu na slici Sl. 7.5.3.

Funkcija:

Sl. 7.5.3. FunkcijaIme funkcije obavezno počinje velikim slovom iza koga slijedi više malih slova. Ovo je učinjeno da bi se razlikovale

funkcije po imenu od varijabli, koje su predstavljene malim slovima.

Ako iza imena funkcije slijedi znak { , tada slijedi tijelo funkcije. Ukoliko iza imena funkcije slijedi znak ; tada jesamo u pitanju deklarisanje funkcije, čije se tijelo nalazi u drugom modulu (drugoj .JEZ ili .OBJ datoteci).

Definisanje funkcije koja je implementirana u drugom modulu se realizuje prostom upotrebom pseudoinstrukcijeEXTRN: EXTRN P_imefunkcije:NEAR

Funkcije koje imaju tijelo se prevode znatno složenije. Na steku se rezerviše prostor za svih 26 parametara, koji iznosi104 bajta (26*4). Parametri se označavaju sa @a, @b, ... , @z, pri čemu @a predstavlja prvi parametar naveden u pozivu, a@z predstavlja 26-ti parametar. Naravno, većina parametara neće biti iskorištena , pa se neiskorišteni parametri moguupotrijebiti kao lokalne varijable. Registar ECX, kako je već rečeno, sadrži veličinu dijela steka potrošenog za parametre, a zalokalne varijable ostaje 104-ECX bajtova. Lokalnim varijablama i parametrima se pristupa relativno u odnosu na EBP registar,pa EBP registar treba pokazivati na vrh steka u trenutku poziva. Sam stek pointer se mora umanjiti kako bi se iz funkcijapozivale druge funkcije, a zatim na stek stavila povratna adresa. Sve navedeno se postiže kodom slike Sl. 7.5.4.

Primjećuje se da nema posebnog koda za vraćanje vrijednosti funkcije. Ona se jednostavno već nalazi u EAX registrukao rezultat posljednjeg aritmetičkog izraza unutar bloka. Instrukcija RET 104 pored povratka iz potprograma ujedno i vratipoziciju stek pointera na vrijednost prije stavljanja prvog argumenta. Ovaj kôd će se pojednostaviti nakon uvođenja provjeraargumenata, u narednom poglavlju.

Sl. 7.5.4. Generisani kôd za tijelo funkcijeRealizacija funkcija, dinamičkih nizova i stringova dovodi do nove sintaksne definicije pojma faktor i skladno s tim

odgovarajuće procedure:

funkcija Velikoslovo

maloslovo ;

{ Blok

Za svaki parametar:

Pozovi IzrazdodjeljivanjaPUSH EAX

MOV ECX,ukupna veličina svih parametara

CALL P_funkcija

P_ImeFunkcije:

POP EDX

ADD ESP,ECX SUB ESP,104

PUSH EDX

PUSH EBP MOV EBP,ESP

Pozovi Blok

POP EBP RET 104

Page 31: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

31Faktor:

Sl. 7.5.5. Faktor

Numeričku konstantu, varijablu ili poziv funkcije moguće je razlikovati po tome da li počinju cifrom, malim ilivelikim slovom.

Lokalne varijable se implementiraju sljedećim kodom

LEA EBX,[EBP+n]

MOV EAX,[EBX]gdje se n računa izrazom n=108-(ord(znak)- ord('a'))*4 .

U ovom izrazu, znak predstavlja ime varijable bez simbola @.

7.6. Testni primjer

Na slici Sl. 7.6.1 dat je program u četvrtoj verziji jezika koji prikazuje na ekranu za brojeve od 1 do 10: broj, imebroja, kvadrat, kub, faktorijel (rekurzivno) te proste faktore tog broja. Program se zove tabbroj.jez i kompajlira koristeći

komp32v4 tabbroj.jez tabbroj.asm

ml /c /coff /Fl tabbroj.asm | morelink /defaultlib:user32.lib kernel32.lib /subsystem:console tabbroj.obj

( Izraz dodjeljivanja )

Numerička konstanta

Faktor*

&

~

!

-

Varijabla

" String konstanta

Poziv funkcije

@

Page 32: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

32

funkcija Prikazistring {asembler extrn GetStdHandle@4:near extrn WriteConsoleA@20:near MOV EAX,-11 ; -11 je parametar za STDOUT PUSH EAX CALL GetStdHandle@4 ; Uzmi hendl za STDOUT MOV ECX,0 ; Petlja koja racuna duzinu stringa MOV EBX,[EBP+108]DUZ: CMP BYTE PTR [EBX],0 JE IZR INC ECX INC EBX JMP DUZIZR: PUSH DWORD PTR 0 ; Rezervisano LEA EBX,[EBP+104] PUSH EBX ; Pointer na broj karaktera koji su prika zani PUSH ECX ; Broj karaktera koji se pisu MOV EBX,[EBP+108] PUSH EBX ; Pointer na string PUSH EAX ; Handle CALL WriteConsoleA@20 ; Ispisi string\}

funkcija Zamijeniznak { asembler MOV EBX,[EBP+108] ; Adresa stringa ADD EBX,[EBP+104] ; Redni broj karaktera MOV EAX,[EBP+100] ; ASCII kod karaktera koji mije njamo MOV [EBX],AL ; Upisuje karakter\}

funkcija Novired { @a:=" "; Zamijeniznak(@a,0,13); Zamijeniznak(@a,1,10); Prikazistring(@a);}

funkcija Prikazibroj { @q:=" "; ` Alociramo bafer @c:=@a;` Negativne brojeve oznaci indikatorom ako (@c<0) { @i:=1; @c:=-@c; } inace { @i:=0; }`maksimalno 9 cifara @p:=9; ako (@c=0) { Zamijeniznak(@q,@p,48);@p:=@p-1;} dok (@c>0) { @o:=(@c % 10); `ostatke dijeljenja u bafer Zamijeniznak(@q,@p,@o+48); @c:=@c/10; ` stalno dijeli s 10 @p:=@p-1; } ako (@i=1) { Zamijeniznak(@q,@p,45); @p:=@p-1; } @q:=@q+@p+1; ` Pomjeri pokazivac pocetka stringa Prikazistring(@q);

}

funkcija Fact{ ako (@a=0) { 1; } inace { @a*Fact(@a-1); }}

funkcija Tabela{ Prikazistring("Tabela"); Novired(); n:=1; dok (n<11) { Prikazibroj (n); Prikazistring(" "); Prikazistring(a[n]); Prikazistring(" "); Prikazibroj (n*n); Prikazistring(" "); Prikazibroj (n*n*n); Prikazistring(" "); Prikazibroj (Fact(n)); Prikazistring(" Djeljiv sa "); m:=1; dok !(m>n) { ako (n%m=0) { Prikazibroj(m); Prikazistring(" "); } m:=m+1; } n:=n+1; Novired(); }}

funkcija Postavinazive{ a:=" "; ` Prostor za niz a[1]:="Jedan"; a[2]:="Dva"; a[3]:="Tri"; a[4]:="Cetiri"; a[5]:="Pet"; a[6]:="Sest"; a[7]:="Sedam"; a[8]:="Osam"; a[9]:="Devet"; a[10]:="Deset";}

{ Postavinazive(); Tabela();}

Sl. 7.6.1. Tablica brojeva, četvrta verzija kompajlera

Funkcija Prikazistring realizovana je u asembleru, jer poziva Windows API funkcije GetStdHandle iWriteConsole. Ove funkcije predstavljaju način ispisa stringa na ekranu koristeći Windowsove sistemske funkcije za rad skonzolnim aplikacijama.

Funkcija GetStdHandle je sistemska funkcija koja vraća broj pridružen ulaznom uređaju, izlaznom uređaju ili uređajugreške. U Windows API funkcijama definisana je ovako

HANDLE GetStdHandle( DWORD nStdHandle // input, output, or error device

);pa je potrebno na stek prije njenog poziva staviti konstantu -11, koja predstavlja STDOUT.

Funkcija WriteConsole je definisana ovako

Page 33: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

33BOOL WriteConsole(

HANDLE hConsoleOutput, // handle to a console screen buffer CONST VOID *lpBuffer, // pointer to buffer to write from

DWORD nNumberOfCharsToWrite, // number of characters to write

LPDWORD lpNumberOfCharsWritten,//pointer to number of chars written LPVOID lpReserved // reserved

);

Windows-ova konvencija je da se parametri za API funkcije smještaju na stek obrnutim redom u odnosu na onaj kojije definisan u zaglavlju funkcije. Asemblerski potprogram priprema sve parametre i smješta ih potrebnim redoslijedom.

Pošto još nema naredbi za pristup pojedinačnim karakterima, u asembleru je napisana i funkcija Zamijeniznak, kojase poziva sa tri parametra, prvi je adresa stringa, drugi redni broj karaktera koji mijenjamo i treći ASCII kôd koji upisujemo.

Ostale funkcije su pisane bez pomoći asemblera. Funkcija Novired ispisuje string koji sadrži kodove CR i LF, čimese prelazi u novi red. Funkcija Prikazibroj pretvara cijeli broj u njegovu ASCII reprezentaciju, koristeći uzastopno dijeljenjesa 10 uz prikazivanje ostataka, a zatim se ta ASCII reprezentacija prikazuje na ekranu, koristeći funkciju PrikaziString .Posebno je interesantna funkcija Fact koja rekurzivno računa faktorijel, koristeći definiciju faktorijela. Dakle, jezik već u ovojfazi podržava i tako složene stvari kao što je rekurzija. Glavna funkcija Tabela je dobro strukturirana i shvatljiva svakome kopoznaje bar jedan viši programski jezik. Jedino treba reći da se u unutrašnjoj petlji (sa m kao brojačem) vrši poređenje ostatka(pri dijeljenju n sa m ) sa brojem 0 i ako je ostatak jednak 0, tada se prikazuje broj kao djelilac. U funkciji Postavinazive seglobalnoj varijabli a pridruži adresa stringa koji ima dosta blankova. Ovaj string služi samo kao rezervisani prostor za 10pokazivača na nove stringove koji sadrže imena brojeva.

Izvršenje programa Tabbroj daje kao rezultat

1 Jedan 1 1 1 Djeljiv sa 12 Dva 4 8 2 Djeljiv sa 1 23 Tri 9 27 6 Djeljiv sa 1 34 Cetiri 16 64 24 Djeljiv sa 1 2 45 Pet 25 125 120 Djeljiv sa 1 56 Sest 36 216 720 Djeljiv sa 1 2 3 67 Sedam 49 343 5040 Djeljiv sa 1 78 Osam 64 512 40320 Djeljiv sa 1 2 4 89 Devet 81 729 362880 Djeljiv sa 1 3 910 Deset 100 1000 3628800 Djeljiv sa 1 2 5 1 0

što je i trebalo dobiti. EXE verzija programa je velika svega 4 kilobajta, jer nema opterećujuće biblioteke, kao u svim drugimkompajlerima. Ova verzija jezika je sasvim upotrebljiva za mnoge primjene iako programi pisani u njoj zahtijevaju dostahakerskih trikova. Tu se prije svega misli na povremenu upotrebu asemblerskog koda. Ipak, asemblerske i druge funkcije seveć u ovoj verziji kompajlera mogu izdvojiti i posebno kompajlirati i linkovati, te na taj način formirati jezgro programskebiblioteke, što u mnogome olakšava programiranje.

7.7. Rezime poglavlja

Četvrta verzija kompajlera uvodi ključne riječi. Ključne riječi se mogu prepoznavati skanerom, koji provjerava slovopo slovo kao konačni automat ili očekivanim uzorkom, poređenjem sa cijelim očekivanim stringom. Odabran je principočekivanih uzoraka, i uzorci se provjeravaju procedurom Slijedi. Dodane su ključne riječi ako, dok, inace, funkcija iasembler. Dodjeljivanje vrijednosti varijabli se vrši simbolom :=. Stringovne konstante se prevode u instrukciju koja registruEAX dodjeljuje adresu stringa. Uvedeni su jednodimenzionalni nizovi, vezani uz pojam pointera. Moguće je pozivati funkcijesa varijabilnim brojem parametara. Parametri se mogu koristiti kao lokalne varijable. Funkcije mogu biti i u eksternimmodulima. Testni primjer uključuje cjelobrojnu aritmetiku i ispis na ekran.

Ovo je najznačajnija verzija kompajlera. Dovoljno je kratka da se može prikazati za jedan nastavni blok-čas, ali opetdovoljno velika da uključuje većinu koncepata iterativnih programskih jezika.

Page 34: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

34

program Kompajler;const GRIZRAZ = 'Izraz'; DUGAKONST = 'Konstanta prevazilazi liniju'; OCEKIVANO = 'Ocekivano '; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; OCEKDOD = 'Ocekivano dodjeljivanje';

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija: integer; znak: char; linija: string;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); NoviSvaki(false); end;

if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat;end;

function Slijedi(ocekivano: string): Boolean;begin if copy(linija, pozicija, Length(ocekivano)) = ocekivano then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

procedure IzrazDodjeljivanja; forward;procedure Blok; forward;

procedure PokazivacINiz;begin Novi; Emit(' PUSH EAX'); IzrazDodjeljivanja; Emit(' POP EBX'); Emit(' SAL EAX,2'); Emit(' ADD EBX,EAX'); Emit(' MOV EAX,[EBX]'); IdiDo(']');end;

procedure StringKonstanta;var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst);end;

procedure PozivFunkcije;var lokalnih: integer; ImeFunkcije, st: string;begin ImeFunkcije := ''; while ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) do begin ImeFunkcije := ImeFunkcije + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi; lokalnih := 0; IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja; Emit(' PUSH EAX'); lokalnih := lokalnih + 4; if znak <> ')' then IdiDo(','); end; IdiDo(')'); Str(lokalnih, st); Emit(' MOV ECX,' + st); Emit(' CALL P_' + ImeFunkcije);end;

procedure Varijabla(glob: Boolean);var rezultat: integer; st: string;begin if glob then begin rezultat := (ord(znak) - ord('a'))

* 4; Str(rezultat, st); Emit(' LEA EBX,GLOBALV[' + st +']'); end else begin Novi; if (znak < 'a') or (znak > 'z') then Greska('Lokalna'); rezultat := 108 - (ord(znak) - ord('a')) * 4; Str(rezultat, st); Emit(' LEA EBX,[EBP+' + st + ']'); end; Emit(' MOV EAX,[EBX]'); Novi; if znak = '[' then PokazivacINiz;end;

procedure Faktor;var rezultat: integer; st: string;begin case znak of '-': begin Novi; Faktor; Emit(' NEG EAX'); end; '~': begin Novi; Faktor; Emit(' NOT EAX'); end; '&': begin Novi; Faktor; Emit(' MOV EAX,EBX'); end; '*': begin Novi; Faktor; Emit(' MOV EBX,EAX'); Emit(' MOV EAX,[EBX]'); end; '!': begin Novi; Faktor; Emit(' CMP EAX,0'); Emit(' SETE AL'); Emit(' AND EAX,0FFh'); end; '"': StringKonstanta; '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; IzrazDodjeljivanja; IdiDo(')'); end; '@': Varijabla(false); 'A'..'Z': PozivFunkcije; 'a'..'z': Varijabla(true) else Greska(GRIZRAZ); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end;

Page 35: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

35 '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-', '&', '|', '^']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; '&': begin Emit(' POP EBX'); Emit(' AND EAX,EBX'); end; '|': begin Emit(' POP EBX'); Emit(' OR EAX,EBX'); end; '^': begin Emit(' POP EBX'); Emit(' XOR EAX,EBX'); end; end; end;end;

procedure IzrazDodjeljivanja;var z: char;begin Izraz; case znak of ':': begin if not (Slijedi(':=')) then Greska(OCEKDOD); Emit(' PUSH EBX'); Novi; IzrazDodjeljivanja; Emit(' POP EBX'); Emit(' MOV [EBX],EAX'); end; {:} '=', '>', '<', '#': begin Emit(' PUSH EAX'); z := znak; Novi; Izraz; Emit(' POP EBX'); Emit(' CMP EBX,EAX'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); end; end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace') then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok') then Petlja else if Slijedi('ako') then Uslov else if Slijedi('asembler') then Asembler else begin IzrazDodjeljivanja; IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija;var ImeFunkcije: string;begin if (znak < 'A') or (znak > 'Z') then Greska(IMEFUN); ImeFunkcije := znak;

Novi; while (znak >= 'a') and (znak <= 'z') do begin ImeFunkcije := ImeFunkcije + znak; Novi; end; case znak of '{': begin Emit('P_' + ImeFunkcije + ':'); Emit(' POP EDX'); Emit(' ADD ESP,ECX'); Emit(' SUB ESP,104'); Emit(' PUSH EDX'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); IdiDo('{'); Blok; Emit(' POP EBP'); Emit(' RET 104'); Emit('PUBLIC P_' + ImeFunkcije); end; ';': begin Emit('extrn P_' + ImeFunkcije + ':near'); IdiDo(';'); end else Greska(DEFFUN); end;end;

procedure Prevedi;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; Novi; while (Slijedi('funkcija')) do begin Novi; DefFunkcija; end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Emit('GLOBALV DD 26 DUP(0)'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin trenlabela := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 36: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

36

8. DEKLARACIJE VARIJABLI, STANDARDNE FUNKCIJE

Iako već prihvatljiva da u nekim kraćim kursevima kompajlera bude i finalna, prethodna verzija kompajlera ima četiriozbiljna nedostatka:

• Jednoslovna imena varijabli ograničavaju jezik na 26 lokalnih/parametarskih i toliko globalnih varijabli. Iako je to čestodovoljno, postoje situacije kada nije. Sem toga, ova imena nisu dovoljno deskriptivna.

• Jedini tip je 32 bitni cijeli broj koji se slučajno poklapa sa pointerom.

• Programski jezik nema nikakve semantičke analize. Sasvim je legalno napisati izraz tipa 5:=2+a; što će upisati vrijednostzbira konstante 2 i varijable a, na neku slučajnu lokaciju gdje je u tom trenutku pokazivao EBX registar. Funkcija možebiti deklarisana više puta, a grešku će primijetiti tek asembler.

• Poziv potprograma nije standardan, pa se sistemske funkcije moraju pozivati iz asemblerskog modula.

8.1. Tabela identifikatora

Uvođenje višeslovnih imena varijabli zahtijeva napuštanje statičkog načina alokacije varijabli i pravljenje tabeleidentifikatora. Tabela identifikatora TabIdent je niz slogova

TIdent=record

ime:string[20];

duzina:integer; adresa:integer;

nivo:integer;

vrsta:Tvrsta; tip:Ttip;

pod1:integer;

pod2:integer; pod3:integer;

end;koji čuvaju ime identifikatora, dužinu, relativnu adresu identifikatora u skupu svih varijabli unutar funkcije ili globalnihvarijabli, nivo koji predstavlja identifikator funkcije kojoj varijabla pripada (ili 0 za globalne), vrstu identifikatora (funkcija,lokalna varijabla, globalna varijabla, parametar), tip identifikatora (karakter, cijeli broj, pointer na karakter, pointer na cijelibroj), kao i tri dodatna podatka za šire objašnjenje identifikatora.

Ova promjena u koncepciji zahtijeva dodavanje novih procedura, kao i da neke procedure u kompajleru buduproširene, a neke čak i nanovo napisane, čime kompajler postaje gotovo duplo duži u odnosu na prethodnu verziju.

Procedura NoviIdent dodaje identifikator u tabelu identifikatora. Dodavanje se vrši trivijalno, uvećanjem brojačaidentifikatora ukupnoident za 1, a zatim upisom svih devet parametara ove procedure u odgovarajuća polja konkretnog slogatabele identifikatora.

U svrhu traženja željenog identifikatora u ovoj tabeli uvodi se funkcija NadjiIdent koja ima za parametre imeidentifikatora, nivo koji predstavlja identifikator funkcije kojoj varijabla pripada (ili 0 za globalne), vrstu uslova i dodatnipodatak. Ova funkcija treba da vrati poziciju navedenog identifikatora u tabeli identifikatora, ili vrijednost 0 ako identifikatornije nađen. Pretraživanje se vrši sekvencijalno jer identifikatori nisu sortirani. No, ono se vrši s kraja prema početku, kako bilokalne varijable bile nađene prije istoimenih globalnih. Značenje parametra “vrsta uslova” dato je u tabeli na slici Sl. 8.1.1.

Broj Značenje

1 Traži lokalnu varijablu, globalnu varijablu, parametar funkcije ili funkciju koja ima ime kaonavedena a nalazi se u funkciji koja se trenutno prevodi ili glavnom programu

2 Traži lokalnu varijablu, globalnu varijablu, parametar funkcije ili funkciju koja ima kaonavedena a nalazi se u ili funkciji koja se trenutno prevodi ili u glavnom programu ako se on utom trenu prevodi

3 Rezervisano

4 Traži parametar funkcije koja se prevodi u ovom trenutku po njegovom rednom broju

Sl. 8.1.1. Parametar Vrsta uslovaProcedura UzmiIdent vraća string vrijednost koja predstavlja niz slova. Algoritam koji implementira tu proceduru

izgleda ovako:

Page 37: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

37Postavi rezultantni string na prazan string

Sve dok slijedi slovo dodaj ga na rezultantni string, i uzmi sljedeći znakAko je sljedeći znak blanko ili komentar dohvati ga kako bi ga rutine ignorisale

Procedura DeklIdent objedinjuje UzmiIdent i NadjiIdent, tj. dohvata identifikator i traži da li on već postoji u tabeli,te ako postoji prijavljuje grešku.

Sada je potrebno proširiti sintaksu jezika. Prvo treba definisati pojam identifikatora, koji je prikazan na slici Sl. 8.1.2.

Identifikator:

Sl. 8.1.2. IdentifikatorRealizacija jezičkog pojma Identifikator urađena je u proceduri UzmiIdent.

8.2. Tipovi

Postoje četiri tipa varijabli, cijeli, karakter, te pointeri na njih. Oni se zajedno definišu u pojmu ImeTipa, (Sl. 8.2.1)koji je implementiran u funkcijama SlijediDekTipa i TipDek. Funkcija

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;

provjerava da li slijedi navedeno ime tipa ili pointer na njega. Ako ne slijedi ni jedno ni drugo, funkcija vraća false. Ime tipa senavodi kao niz karaktera, a u varijablu tip funkcija vraća oznaku tipa ili pointera na njega. Ove oznake se navode kaoparametri stip i ptip i mogu biti karakter , cijeli , pkarakter i pcijeli . Rogobatna sintaksa funkcije TipDek se prevazilazifunkcijom

function SlijediDekTipa(var tip: TTip):Boolean

koja vraća true ako slijedi ime bilo kojeg tipa, a kao bočni efekt u varijabli tip se dobije oznaka tog tipa.

ImeTipa

Sl. 8.2.1. Ime tipa Veličina prostora koji zauzima pojedinačna varijabla nekog tipa dobija se funkcijom DuzinaTipa. Za tip karakter ,

ta vrijednost iznosi 1 bajt, dok za tipove cijeli , pkarakter i pcijeli veličina prostora je 4 bajta.

8.3. Deklarisanje varijabli i nova struktura programa

Nakon uvođenja identifikatora i imena tipa, može se pristupiti deklarisanju varijabli. Deklaracija varijabli izgleda kaona slici Sl. 8.3.1.

Deklaracija varijabli:

Sl. 8.3.1. Deklaracija varijabli

Identifikator

,

;ImeTipa

cijeli *

karakter *

Slovo (veliko ili malo)

Slovo (veliko ili malo)

_

Cifra

Page 38: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

38Na primjer:

cijeli Duzina, Sirina;karakter * ime;

U suštini, deklaracija svake nove varijable jednostavno povećava ukupnu veličinu prostora za same varijable, bilo uprostoru za globalne varijable, bilo na steku za lokalne varijable. Tada se u slogu koji predstavlja dati identifikator upišerelativna adresa gdje se nalazi varijabla kojoj se pristupa. Dakle, u generisanom asemblerskom kodu se ne čuva ime varijable.

Pojam programa sada uključuje deklaraciju varijabli, definiciju funkcija i glavni blok. Varijable i funkcije se mogu uprogramu neograničeno puta ponavljati. Ako se u glavnom bloku nalazi samo zatvorena zagrada, tada je riječ o bibliotecifunkcija. Nova definicija pojma Program nalazi se na slici Sl. 8.3.2.

Program:

Sl. 8.3.2. ProgramDeklaracija funkcije će biti prikazana kasnije.

8.4. Izrazi i semantika

Uvođenje jedinstvenog sistema identifikatora zahtijeva izmjenu jezičkog pojma Faktor u kome se zbog toga ukidasintaksa lokalnih varijabli sa znakom @, te prepoznavanje funkcije tako što joj ime počinje velikim slovom. Sada je pogodantrenutak i za uvođenje znakovne konstante koja se, kao u C-u, navodi između jednostrukih navodnika. Jezički pojam Faktorsada izgleda kao na slici Sl. 8.4.1

Faktor:

Sl. 8.4.1. Faktor

Deklaracijavarijabli

Deklaracijafunkcije

{ Blok

}

( Izraz dodjeljivanja )

Numerička konstanta

Faktor*

&

~

!

-

Varijabla

" String

Poziv funkcije

‘ Slovo ‘

Page 39: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

39Realizacija slovne konstante je trivijalna i svodi se na prostu MOV AL,konstanta instrukciju. No, iako se sintaksno ne

mijenjaju ostali jezički pojmovi koji sačinjavaju izraz, procedure koje ga realizuju potrebno je radikalno promijeniti. Razlogtome je uvođenje semantike i različitih tipova.

Ozbiljan semantički problem da je u prethodnim verzijama kompajlera moguće napisati 5+3:=a-8; rješava seuvođenjem varijabilnog parametra dod u sve procedure koje realizuju aritmetičke izraze. Prilikom obrade dijela izraza, ovomparametru daje se vrijednost true, ako se tom dijelu izraza može dodijeliti vrijednost. Tipično, to su varijable, elementi nizova ilokacije na koje pokazuju pointeri. Ovaj parametar će se provjeravati u proceduri IzrazDodjeljivanja nakon prvog pozivaprocedure Izraz i prijaviti greška ukoliko on nema tačnu vrijednost.

Procedurama koje predstavljaju dijelove aritmetičkih izraza dodaje se još jedan varijabilni parametar. Preko togparametra se vraća tip dijela aritmetičkog izraza, tj. da li je karakter, cijeli broj, pointer itd.

Jezik koji se ovdje razvija spada u jezike slabe tipiziranosti i omogućava automatske konverzije između podatakarazličitih tipova prilikom dodjeljivanja. To znači da je legalno napisati

a:=’#’+1;gdje je a cjelobrojna varijabla. Iako su sabirci u gornjem zbiru različitog tipa (karakter i cijeli broj), ipak rezultat

predstavlja cijeli broj 36, jer je ASCII kôd znaka # jednak 35.

Cijeli brojevi i pointeri zahtijevaju četiri bajta za njihovo predstavljanje, dok se karakteri mogu smjestiti u jedan bajt.Baš kao što se za smještanje cijelih brojeva u toku izraza koriste registri EAX, EBX i stek, za karaktere se koriste AL, BL istek, pri čemu se zbog karakteristika steka na stek smještaju čitavi EAX/EBX registri.

U primjeru “a:=’#’+1” kompajler generiše kôd za smještanje konstante 35 u registar AL, ali nakon toga nalazicjelobrojnu konstantu 1, zaključuje da je ipak riječ o izrazu sa 32 bitnim rezultatom pa registar AL konvertuje u EAX inastavlja da generiše kôd kao da je riječ o sabiranju dva 32 bitna broja. Konverzija registra AL u EAX se vrši postavljanjemviših 24 bita na nula instrukcijom AND.

Većina udžbenika o kompajlerima izbjegava miješanje različitih tipova podataka unutar jednog aritmetičkog izraza.Razlog je u tome što je broj potrebnih konverzija jednak kvadratu broja tipova koji se u tom izrazu mogu pojaviti. Razrješenjutog problema pomažu tablice, navedene u sljedećoj tački.

8.5. Tablice generisanog koda za različite operande

Pošto ima dosta kombinacija lijevog i desnog operanda, za sve binarne i unarne operatore potrebno je napravitiodgovarajuće tablice koje određuju kakav će se kôd generisati zavisno od operatora i tipa operanada. Pri prikazu generisanogkoda, dio koji se jednom ili više puta ponavlja (ukoliko se dati operator uzastopno ponavlja više puta) stavljen je u vitičastezagrade.

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

karakter Clan{PUSH EAXClanPOP EBXADD AL,BL}

Clan{PUSH EAXClanPOP EBXAND EBX,0FFhADD EAX,EBX}

Nije dopušteno Nijedopušteno

cijeli Clan{PUSH EAXClanPOP EBXAND EAX,0FFhADD EAX,EBX}

Clan{PUSH EAXClanPOP EBXADD EAX,EBX}

Nije dopušteno Nijedopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

+Samo za slučajsabiranja dvakarakterarezultat je tipakarakter, usvim ostalimslučajevimarezultat jecijeli broj

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

Sl. 8.5.1. Generisani kôd za sabiranje zavisno od tipova argumenata

Page 40: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

40

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

karakter Clan{PUSH EAXClanMOV EBX,EAXPOP EAXSUB AL,BL}

Clan{PUSH EAXClanMOV EBX,EAXPOP EAXAND EAX,0FFhSUB EAX,EBX}

Nije dopušteno Nijedopušteno

cijeli Clan{PUSH EAXClanMOV EBX,EAXPOP EAXAND EBX,0FFhSUB EAX,EBX}

Clan{PUSH EAXClanMOV EBX,EAXPOP EAXSUB EAX,EBX}

Nije dopušteno Nijedopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

-Samo za slučajoduzimanjadva karaktera

rezultat je tipakarakter, usvim ostalimslučajevimarezultat jecijeli broj cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nije

dopušteno

Sl. 8.5.2. Generisani kôd za oduzimanje zavisno od tipova argumenata

Iz tabela sa sabiranje i oduzimanje (Sl. 8.5.1 i Sl. 8.5.2) vidi se da pointerski tipovi ne mogu učestvovati uoperacijama sabiranja i oduzimanja. Samo ako su oba operanda karakteri koriste se instrukcije ADD AL,BL ili SUB AL,BL.Ako je jedan operand karakter ubacuje se AND EAX,0FFh ili AND EBX,0FFh. Na ovaj način se tri viša bajta EAX ili EBXregistra postavljaju na nule, bez izmjena registara AL odnosno BL. To predstavlja efikasnu konverziju između karaktera icijelih brojeva. Ako su oba operanda cijeli brojevi, nema dodatnih instrukcija.

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

&

rezultat jekarakter ako suoba argumentatog tipa, inačecijeli

Cijeli ilikarakter

Clan{PUSH EAXClanPOP EBXAND EAX,EBX}

Clan{PUSH EAXClanPOP EBXAND EAX,EBX}

Nije dopušteno Nijedopušteno

|

tip kao kod &

Cijeli ilikarakter

Clan{PUSH EAXClanPOP EBXOR EAX,EBX}

Clan{PUSH EAXClanPOP EBXOR EAX,EBX}

Nije dopušteno Nijedopušteno

^

tip kao kod &

Cijeli ilikarakter

Clan{PUSH EAXClanPOP EBXXOR EAX,EBX}

Clan{PUSH EAXClanPOP EBXXOR EAX,EBX}

Nije dopušteno Nijedopušteno

Sl. 8.5.3. Generisani kôd za logičke operacije zavisno od tipova argumenata

Logičke operacije (Sl. 8.5.3) nemaju prijenosa, jer se obavljaju bit po bit. Kod ovih instrukcija nema potrebe zaspecijalnim slučajevima u kodu.

Page 41: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

41

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

karakter Faktor{PUSH EAXFaktorPOP EBXAND EAX,0FFhAND EBX,0FFhIMUL EBX}

Faktor{PUSH EAXFaktorPOP EBXAND EBX,0FFhIMUL EBX}

Nije dopušteno Nijedopušteno

cijeli Faktor{PUSH EAXFaktorPOP EBXAND EAX,0FFhIMUL EBX}

Faktor{PUSH EAXFaktorPOP EBXIMUL EBX}

Nije dopušteno Nijedopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

*

Tip rezultata jeuvijek cijelibroj

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

Sl. 8.5.4. Generisani kôd za množenje zavisno od tipova argumenata

Na slici Sl. 8.5.4 se vidi da pri množenju nisu dopušteni pointeri kao faktori, a da se faktori koji su tipa karaktertrebaju prije množenja konvertovati u cijeli broj instrukcijama AND EAX,0ffh ili AND EBX,0ffh.

Operacija Desni

Lijevi

Karakter Cijeli karakter * cijeli *

karakter Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhAND EBX,0FFhCDQIDIV EBX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhCDQIDIV EBX}

Nije dopušteno Nijedopušteno

cijeli Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EBX,0FFhCDQIDIV EBX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXCDQIDIV EBX}

Nije dopušteno Nijedopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

/

Tip rezultata jeuvijek cijelibroj

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

Sl. 8.5.5. Generisani kôd za dijeljenje zavisno od tipova argumenata

Page 42: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

42

Operacija Desni

Lijevi

Karakter Cijeli karakter * cijeli *

karakter Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhAND EBX,0FFhCDQIDIV EBXMOV EAX,EDX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhCDQIDIV EBXMOV EAX,EDX}

Nije dopušteno Nijedopušteno

cijeli Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EBX,0FFhCDQIDIV EBXMOV EAX,EDX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXCDQIDIV EBXMOV EAX,EDX}

Nije dopušteno Nijedopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

%

Tip rezultata jeuvijek cijelibroj

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nijedopušteno

Sl. 8.5.6. Generisani kôd za ostatak pri dijeljenju zavisno od tipova argumenata

Na slikama Sl. 8.5.5 i Sl. 8.5.6 se vidi da pri dijeljenju i ostatku pri dijeljenju nisu dopušteni pointeri kao operandi, ada se operandi koji su tipa karakter trebaju prije dijeljenja konvertovati u cijeli broj instrukcijama AND EAX,0ffh ili ANDEBX,0ffh.

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

karakter IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

cijeli IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

karakter * Nije dopušteno IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

:=

Tip rezultata jetip koji imaoperand salijeve straneoperatora

cijeli * Nije dopušteno IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

Sl. 8.5.7. Generisani kôd za dodjeljivanje zavisno od tipova argumenata

Iz tabele Sl. 8.5.7 vidi se da se karakter ne smije dodijeliti pointeru, a da je međusobna razlika svih ostalihkombinacija tipova operanada u tome što ako se s lijeve strane izraza dodjeljivanja nalazi varijabla karakterskog tipa, da se nanavedenu adresu na koji pokazuje registar EBX upisuje sadržaj registra AL. Pointerske varijable se mogu dodjeljivaticjelobrojnim i obrnuto, bez eksplicitnog navođenja imena tipa (type casting).

Page 43: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

43

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

karakter IzrazPUSH EAXIzrazPOP EBXCMP BL,ALSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXAND EAX,0FFhCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXAND EAX,0FFhCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXAND EAX,0FFhCMP EBX,EAXSETE ALAND EAX,0FFh

cijeli IzrazPUSH EAXIzrazPOP EBXAND EBX,0FFhCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

karakter * IzrazPUSH EAXIzrazPOP EBXAND EBX,0FFhCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

= # < >

Tip rezultata jeuvijek cijelibroj.PromijenitiinstrukcijuSETE u

Za = SETE

Za < SETL

Za > SETG

Za # SETNE

cijeli * IzrazPUSH EAXIzrazPOP EBXAND EBX,0FFhCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAXSETE ALAND EAX,0FFh

Sl. 8.5.8. Generisani kôd za poređenje zavisno od tipova argumenata

Tabela na slici Sl. 8.5.8 obuhvata sva četiri relaciona operatora, pri čemu je za svaki navedeni operator potrebnoupisati odgovarajuću SETxx instrukciju.

Unarni operatori i generisani kôd za njih su navedeni na slici Sl. 8.5.9.

Operacija Karakter cijeli karakter * cijeli *

Unarni - Nije dopušteno FaktorNEG EAX(rez. tip je cijeli )

Nije dopušteno Nije dopušteno

Unarni * Nije dopušteno Nije dopušteno FaktorMOV EBX,EAXMOV EAX,[EBX]AND EAX,0FFh(rez. tip jekarakter )

FaktorMOV EBX,EAXMOV EAX,[EBX](rez. tip jecijeli)

Unarni & FaktorMOV EAX,EBX(rez. tip je karakter *)

FaktorMOV EAX,EBX(rez. tip je cijeli *)

FaktorMOV EAX,EBX(rez. tip jecijeli *)

FaktorMOV EAX,EBX(rez. tip jecijeli *)

Unarni ! CMP EAX,0SETE ALAND EAX,0FFh(rez. tip je karakter )

CMP EAX,0SETE AL(rez. tip je cijeli )

Nije dopušteno Nije dopušteno

Unarni ~ FaktorNOT AL(rez. tip je karakter )

FaktorNOT EAX(rez. tip je cijeli )

Nije dopušteno Nije dopušteno

Sl. 8.5.9. Generisani kôd za unarne operatore zavisno od tipova argumenata

Na bazi gornjih tabela se mijenjaju funkcije Clan, Faktor , Izraz i IzrazDodjeljivanja . Iskorištavaju se uočenepravilnosti u generisanom kodu, jer nema potrebe mnogo puta ponavljati isti skup naredbi.

8.6. Funkcije i provjera parametara

Deklaracija funkcije se u ovoj verziji kompajlera proširuje definisanjem svih parametara i lokalnih varijabli kojefunkcija može imati, kao na slici Sl. 8.6.1.

Page 44: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

44

Sl. 8.6.1. Deklaracija funkcije

Deklarisanje parametara i lokalnih varijabli se realizuje tako da se za svaki prepoznati identifikator dodaju podaci onjemu u tabelu identifikatora, pri čemu se za nivo uzima pozicija identifikatora funkcije u tabeli svih identifikatora.

Po Windowsovom standardu svi parametri, bez obzira na veličinu, moraju biti poravnati na adrese djeljive sa 4. Podporavnanjem se podrazumijeva smještanje svih podataka tako da počinju od adrese djeljive s nekim paranim brojem. Lokalnevarijable moraju biti poravnate na adrese djeljive sa 4 ako je njihova dužina djeljiva sa 4. Prema redoslijedu smještanjaparametara na stek razlikuju se konvencije:

a) C call, parametri se smještaju na stek PUSH instrukcijama u obrnutom redoslijedu u odnosu na navedeni u pozivufunkcije, a poziciju stek pointera vraća u prvobitno stanje glavni program. Ovaj način poziva se koristi uWindows API funkciji wvsprintf i svim funkcijama biblioteke MSVCRT.DLL (biblioteka Microsoft Ckompajlera)

b) Pascal call, parametri se smještaju na stek PUSH instrukcijama u istom redoslijedu u odnosu na navedeni, apoziciju stek pointera vraća u prvobitno stanje potprogram. Koristi se u svim sistemskim pozivima za Windows3.1 aplikacije

c) StdCall, parametri se smještaju na stek PUSH instrukcijama u obrnutom redoslijedu u odnosu na navedeni, apoziciju stek pointera vraća u prvobitno stanje potprogram. Koristi se u većini Win32 API funkcija.

d) Fast Call, parametri su u registrima, koristi se pri pozivu DOS interapta

e) Inline Call, parametri se navode u memorijskom bloku, (na fiksnoj lokaciji ili neposredno iza CALL instrukcije=obično se interno koristi u asemblerskim programima.

Najlakše je prilagoditi postojeći kompajler da generiše pozive po Pascal Call standardu, pa će ovaj način poziva biti iimplementiran. Pri tome će se ime potprograma generisati od imena funkcije iza kojeg slijedi znak @ i ukupan broj bajtovakoliko zauzimaju parametri. Tako na primjer funkcija čije je ime Racunaj i koja ima tri parametra će u generisanom koduimati ime Racunaj@12. Ovo je učinjeno da bi se postigla izvjesna kompatibilnost sa Win32 API funkcijama koje imajuinterno iste ovakve nazive, a kojih postoji preko 9000.

Windows API funkcije, međutim, koriste standard StdCall, koje zahtijeva suprotan redoslijed postavljanja parametarana stek od standarda Pascal Call. Ovaj problem je rješiv tako što se pri pozivu ovih funkcija navode parametri obrnutimredoslijedom u odnosu na onaj kojim se parametri navode u jeziku C i kako su definisan u standardnoj dokumentaciji zaWindows API.

Generisani kôd za definiciju funkcije izgleda kao na slici Sl. 8.6.2.

Sl. 8.6.2. Definicija funkcije, generisani kôdPostavljanje EBP registra na mjesto gdje se ESP nalazio prije alokacije prostora za lokalne varijable, omogućava da

se lokalnim varijablama pristupa sa MOV EAX,[EBP-nn] a parametrima sa MOV EAX,[EBP+nn]. Odgovarajuće konstante nnse računaju prilikom deklaracija lokalnih varijabli i parametara i nalaze se u polju adresa tabele identifikatora. Za parametre,prije dohvatanja prvog parametra ovo polje ima vrijednost 0, a zatim se uvećava za ((duzinavarijable-1) div 4 + 1)*4 nakon

PUSH EBP

Racunaj@12: (zavisno od imena i prostora za parametre) MOV EBP,ESP

SUB ESP,velicina prostora za lokalne varijable

Pozovi Blok; MOV ESP,EBP

POP EBP

RET velicina prostora za parametre

PUBLIC Racunaj@12

Identifi-kator

( Identifi-kator

ImeTipa ImeTipa )

,

{ BlokDeklaraciavarijabli

funkcija

;

Page 45: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

45svakog deklarisanog parametra. Za lokalne varijable, prije dohvatanja prve lokalne varijable, ovo polje ima vrijednost 0, azatim se, kako se redom dohvataju varijable, po apsolutnoj vrijednosti uvećava za duzinavarijable, a upisuje se negativnavrijednost.

Generisani kôd za poziv funkcije, prikazan na slici Sl. 8.6.3 se vrlo malo promijenio od prethodne verzije kompajlera

Sl. 8.6.3. Generisani kôd za poziv funkcije

Globalnim varijablama se i sada pristupa sa MOV EAX,GLOBALV[nn] pri čemu se nn nalazi u polju adresa tabeleidentifikatora. Ako je varijabla tipa karakter registar EAX treba zamijeniti registrom AL. Prilikom deklaracije globalnihvarijabli prije dohvatanja prve globalne varijable ovo polje ima vrijednost 0, a zatim se kako se redom dohvataju varijable poapsolutnoj vrijednosti uvećava za duzinavarijable.

Koristeći sve ove informacije, može se napisati nova verzija kompajlera. Navedena je u prilogu broj 5.

8.7. Testni primjer

Primjer programa u petoj verziji jezika može biti identičan prethodnom primjeru, uz izbacivanje potrebe da se dijelovipišu u asembleru. Ipak, pošto dosadašnji primjeri nisu imali ulaz, dodano je da se unese ime korisnika na početku, a zatim onoi prikaže na ekranu. Za čitanje se koristi API funkcija ReadConsoleA, koja ima iste parametre kao i WriteConsoleA, samo štozahtijeva standardni hendl –10, umjesto –11.

Primjer se prevodi koristeći

komp32v5 tabbroj2.jez tabbro2j.asm

ml /c /coff /Fl tabbroj2.asm | more

link /defaultlib:user32.lib kernel32.lib /subsystem:console tabbroj2.obj

Izvorni kôd primjera naveden je na slici Sl. 8.7.1

Za svaki parametar (osim ako se karakter prosljeđuje pointeru što je greška):

Pozovi Izrazdodjeljivanja

Ako se karakter prosljeđuje cijelim brojevima generiši AND EAX,0FFh

PUSH EAX

MOV ECX,ukupna veličina svih parametara

CALL funkcija@duzinaparametara

Ako funkcija vraća karakter generiši AND EAX,0FFh

Page 46: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

46

cijeli funkcija GetStdHandle(cijeli brhan);cijeli funkcija WriteConsoleA(cijeli rez,cijeli * u pisano, cijeli upisati,karakter * bafer,cijeli han);cijeli funkcija ReadConsoleA(cijeli rez,cijeli * up isano, cijeli upisati,karakter * bafer,cijeli han);cijeli * a; ` Ovo je zapravo niz pointera na string ovecijeli * ime;cijeli funkcija Prikazistring (karakter * poruka){ cijeli handle,priv,duz; handle:=GetStdHandle(-11); duz:=0; dok (poruka[duz]#0) { duz:=duz+1;} WriteConsoleA(0,&priv,duz,poruka,handle);}cijeli funkcija Unesistring (karakter * poruka){ cijeli handle,priv,duz; handle:=GetStdHandle(-10); duz:=30; ReadConsoleA(0,&priv,duz,poruka,handle);}cijeli funkcija Novired () { karakter * dvoznak; dvoznak:=" "; dvoznak[0]:=13; dvoznak[1]:=10; Prikazistring(dvoznak);}cijeli funkcija Predstavljanje (){ ime:=" " ; Unesistring(ime); Prikazistring("Tabelu generisao "); Prikazistring(ime); Novired();}cijeli funkcija Prikazibroj (cijeli broj){ cijeli cifra,negativan,pokazivac,ostatak; karakter * bafer; bafer:=" "; ` Alociramo bafer cifra:=broj;` Negativne brojeve oznaci indikatorom ako (cifra<0) { negativan:=1; cifra:=-cifra; } inace { negativan:=0; }`maksimalno 9 cifara pokazivac:=9; ako (cifra=0) { bafer[pokazivac]:='0'; pokazivac:=pokazivac-1; } dok (cifra>0) { ostatak:=(cifra % 10);`ostatke dijeljenja u bafer bafer[pokazivac]:=ostatak+'0'; cifra:=cifra/10; ` stalno dijeli s 10 pokazivac:=pokazivac-1; } ako (negativan=1) {

bafer[pokazivac]:='-'; pokazivac:=pokazivac-1; } bafer:=&(bafer[pokazivac+1]);` Pomjeri pokazivac pocetka stringa Prikazistring(bafer);}cijeli funkcija Fact(cijeli a){ ako (a=0) { 1; } inace { a*Fact(a-1); }}cijeli funkcija Tabela(){ cijeli m,n; Prikazistring("Tabela"); Novired(); n:=1; dok (n<11) { Prikazibroj (n); Prikazistring(" "); Prikazistring(a[n]); Prikazistring(" "); Prikazibroj (n*n); Prikazistring(" "); Prikazibroj (n*n*n); Prikazistring(" "); Prikazibroj (Fact(n)); Prikazistring(" Djeljiv sa "); m:=1; dok !(m>n) { ako (n%m=0) { Prikazibroj(m); Prikazistring(" "); } m:=m+1; } n:=n+1; Novired(); }}cijeli funkcija Postavinazive(){ a:=" "; ` Prostor za niz a[1]:="Jedan"; a[2]:="Dva"; a[3]:="Tri"; a[4]:="Cetiri"; a[5]:="Pet"; a[6]:="Sest"; a[7]:="Sedam"; a[8]:="Osam"; a[9]:="Devet"; a[10]:="Deset";}{ Predstavljanje(); Postavinazive(); Tabela();}

Sl. 8.7.1. Primjer: Tablica brojeva bez asemblerskih modula

8.8. Rezime poglavlja

Ova verzija kompajlera predstavlja veliki skok naprijed i omogućava realizaciju većine aplikacija koje koriste cijele brojeve istringove. Uvedeni su tipovi cijeli , cijeli * , realni i realni * . Program se sada sastoji iz deklaracija varijabli, deklaracijafunkcija i tijela programa Imena varijabli se sastoje iz više slova, pa je potrebna tablica identifikatora. Pri pozivu funkcijaprovjerava se broj i tipovi argumenata. Uvođenje tipova usložnjava aritmetičke izraze i zahtijeva pažljivo praćenje generisanogkoda za svaku kombinaciju operanada različitog tipa. U testnim primjerima opada potreba za asemblerom.

Page 47: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

47Prilog 5: Verzija izvornog koda kompajlera br. 5program Kompajler;const MAXIDENT = 1024; DUGAKONST = 'Konstanta prevazilazi liniju'; OCEKIVANO = 'Ocekivano '; REDEKLAR = 'Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG = 'Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ = 'Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator';

type TVrsta = (funkcija, lokalna, globalna, parametar); TTip = (karakter, cijeli, pkarakter, pcijeli); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; end;

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija, aktnivo: integer; znak: char; linija: string; TabIdent: array[0..MAXIDENT] of TIdent; ukupnoident: integer; t: TTip; dod: Boolean;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; end;end;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);

end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat; t := cijeli; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true;

if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;begin TipDek := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; Novi end else tip := stip; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;begin case tip of cijeli, pcijeli, pkarakter: DuzinaTipa := 4; karakter: DuzinaTipa := 1; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 4: Uslov := (TabIdent[n].nivo = nivo) and

Page 48: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

48 (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta = parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean);var t1: TTip;begin Novi; Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); else Emit(' MOV EAX,[EBX]'); end; IdiDo(']'); dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) =

'''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if (t1 = karakter) and (t2 in [pkarakter, pcijeli]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); velsteka := velsteka + 4; Emit(' PUSH EAX'); if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh0');end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); else Emit(' MOV EAX,[EBX]'); end; dod := true; if znak = '[' then PokazivacINiz(t, dod);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer; st, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of

cijeli: Emit(' NEG EAX'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod); end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna:

Page 49: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

49 Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end;end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor(t2, dod); dod := false; if ((t1 <> cijeli) and (t1 <> karakter)) or ((t2 <> cijeli) and (t2 <> karakter)) then Greska(POGRMNOZ); t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan(t2, dod); dod := false; if ((t1 <> cijeli) and (t1 <> karakter)) or ((t2 <> cijeli) and (t2 <> karakter)) then Greska(NEDOPARIT); case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX');

Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; t1 := t; end;end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean;begin Izraz(t1, dod1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); Novi; IzrazDodjeljivanja(t2, dod); Emit(' POP EBX'); if (t2 = karakter) and (t1 <> karakter) and (t1 <> cijeli) then Greska(DODJPOINT); if t1 = karakter then Emit(' MOV [EBX],AL') else Emit(' MOV [EBX],EAX'); t := t1; end; {:} '=', '>', '<', '#': begin Emit(' PUSH EAX'); z := znak; Novi; Izraz(t2, dod); Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end;end;

procedure Uslov;var

sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0);

Page 50: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

50 NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip) - 1) div 4 + 1) * 4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, 0); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta = parametar) then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, 0); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4) <> 0 do lokadresa := lokadresa + 1; IdiDo(';');

end; Str(paradresa, st); Emit(ImeFunkcije + '@' + st + ':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC ' + ImeFunkcije + '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;

procedure Prevedi;var globadresa: Integer; ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip,

0, 0, 0); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB ' + st + ' DUP(0)'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin trenlabela := 0; ukupnoident := 0; aktnivo := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 51: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

51

9. REALNI BROJEVI

Na listi prioriteta koje treba implementirati slijede realni (floating point) brojevi. Iako se mnogi problemi kojizahtijevaju upotrebu ovih brojeva mogu riješiti i cjelobrojnom aritmetikom uz potrebno skaliranje (fixed point), preostajuproblemi kod kojih je aritmetika u pokretnom zarezu nezamjenjiva.

9.1. Koprocesor

Izbor procesora 486 i Pentium za ciljnu arhitekturu navodi da se aritmetika u pokretnom zarezu realizuje koristećiinstrukcije koprocesora koji je u njih ugrađen, umjesto pisanja posebnih potprograma. Čak i za procesore 386 i 486SX (kojimakoprocesor nedostaje), Windows 95 obezbjeđuje softverske emulatore koprocesora.

Instrukcije za rad u pokretnom zarezu su drugačije koncipirane od instrukcija za cjelobrojnu aritmetiku. One neoperišu sa uobičajenim registrima, nego imaju interni stek na koji može da stane osam konstanti, velikih 32, 64 ili 80 bita.

Kao optimalna veličina FP brojeva uzeće se 64 bita, tj. dvostruka preciznost. Brojevi u memoriji su predstavljeni poIEEE-754 standardu. Po ovom standardu, bitovi 0-51 predstavljaju mantisu, bitovi 52-62 predstavljaju eksponent, a bit 63predznak broja.

9.2. Realne konstante

Prije svega je potrebno proširiti sintaksu numeričke konstante. Gotovo svi programski jezici poznaju realne brojeve uformi “2.4E-8” , što predstavlja 2,4·108 u klasičnom obliku. Pri tome se mogu izostaviti predznak eksponenta, čitaveksponentski dio ili necijeli dio frakcije. Stoga nova sintaksa za numeričke konstante izgleda kao na slici Sl. 9.2.1

Numerička konstanta

Sl. 9.2.1. Numerička konstanta

Konvertovanje brojeva iz uobičajenog dekadnog formata tipa “2.4E-8” u format “binarna mantisa i eksponent” jesložen, neportabilan, posao koji je podložan numeričkim greškama. Na sreću, većina 32-bitnih asemblera već poznaje ovajformat konstanti, pa je dovoljno proslijediti izvorno napisan broj asembleru, koji će pravilno upisati u memoriju konstanteoblika

KONST DQ 2.4E-8

Stoga je nova verzija procedure UzmiKonstantu razmjerno jednostavna. Ova procedura pored računa cjelobrojnekonstante, sve njene znakove pridodaje na jedan string, koji je u globalnoj varijabli realnakonstanta. Ako se pri dohvaćanjuznakova naiđe na znak ‘.’ ili ‘E’, prestaje se s računom cjelobrojne konstante, ali se nastavlja pridodavanje znakova naspomenutu globalnu string varijablu, uz stalnu provjeru sintakse.

U okviru procedure Faktor, prilikom obrade numeričkih konstanti se provjeri da li je procedura UzmiKonstantuvratila cjelobrojnu ili realnu vrijednost. U slučaju cjelobrojne vrijednosti generiše se uobičajena MOV EAX,nn instrukcija.Ako je u pitanju realna konstanta, tada se vrijednost te konstante ne treba staviti u EAX registar nego na vrh FP steka. Da bi seto postiglo treba generisati sljedeći kôd

.DATA

L12 DQ 2.4E-8.CODE

FLD L12pri čemu su oznaka labele i konstanta dati radi ilustracije.

9.3. Komunikacija između FP steka i memorije

FP stek je ograničen na svega osam konstanti, za razliku od steka adresiranog ESP registrom za koji je operativnisistem rezervisao nekoliko desetina kilobajta. To onemogućava rekurzivno računanje nekih funkcija, pa je potrebno omogućiti

Cifra.

Cifra E

+

-

Cifra

Page 52: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

52privremeno čuvanje međurezultata FP operacija i na steku adresiranom ESP registrom. U tu svrhu, kao i radi konverzijeizmeđu formata, se uvode sljedeće procedure:

CijeliNaFPStek (sadržaj cjelobrojnog registra se prebacuje na vrh FP steka) generiše sljedeći kôd

Ako se posmatra samo nižih osam bita cijelog broja

generiši AND registar,0FFh MOV INTTOFP,registar

FILD DWORD PTR INTTOFP

FPStekUCijeli (broj s vrha FP steka se prebacuje u cjelobrojni registar. Kao privremena lokacija u memoriji koristise vrh ESP adresiranog steka) generiše sljedeći kôd

ADD ESP,-4 FISTP DWORD PTR [ESP]

POP registar

CPUStekCijeliNaFPStek (cijeli broj sa vrha ESP adresiranog steka prebacuje se na vrh FP steka) generiše sljedećikôd

Ako se posmatra samo nižih osam bita cijelog broja

generiši AND DWORD PTR [ESP],0FFh

FILD DWORD PTR [ESP]

ADD ESP,4

FPUStekNaStek (broj u pokretnom zarezu se prebacuje sa vrha FP steka na vrh ESP adresiranog steka) generišesljedeći kôd

ADD ESP,-8

FSTP QWORD PTR [ESP]

StekNaFPUStek (broj u pokretnom zarezu se prebacuje sa vrha ESP adresiranog steka na vrh FP steka) generišesljedeći kôd

FLD QWORD PTR [ESP]ADD ESP,8

Gore navedene funkcije potrebne su i zato što ne postoje instrukcije za direktno prebacivanje podataka iz FP internogsteka u cjelobrojne registre.

9.4. Aritmeti čke operacije

Aritmetičke operacije nad realnim brojevima za slučaj sabiranja, oduzimanja, množenja i dijeljenja uvijek kao rezultatimaju realan broj, bez obzira da li je drugi argument ovih operacija cijeli broj, realni broj ili karakter.

Sabiranje u kome je bar jedan sabirak FP broj se može realizovati kodom sa slike Sl. 9.4.1.

Sl. 9.4.1. Generisanje koda za sabiranje u pokretnom zarezu

Pozovi ČlanAko je prvi član cijeli broj ili karakter generiši PUSH EAX inače pozovi FPUStekNaStek

Pozovi Član

Ako nijedan član nije realan broj, generiši kôd kao i ranije, prema tablicama izprethodnog poglavlja

Ako je drugi član cijeli broj ili karakter a prvi član je bio realni broj pozoviCijeliNaFPStek za registar EAX

Ako je prvi član cijeli broj ili karakter pozovi CPUStekCijeliNaFP, a ako je realni pozoviStekNaFPUStek

Generiši FADD

Page 53: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

53Potreba za privremenim čuvanjem podataka na procesorskom steku, radi omogućivanja rekurzije, dovodi do

redundantnog koda u još izraženijem obliku nego kod cjelobrojne aritmetike. Za sada se zanemaruje taj problem, jer je u ovomtrenutku tačnost i jednostavnost kompajlera u prvom planu.

Realizacija oduzimanja, množenja i dijeljenja se ne razlikuje mnogo od realizacije sabiranja. Kod ove tri operacije jepotrebno umjesto FADD respektivno generisati instrukcije FSUBR, FMUL i FDIVR, koje kao i FADD obavljaju operaciju naddva broja na vrhu FP steka, uklone ih sa FP steka i rezultat opet ostavljaju na vrh FP steka. Za množenje i dijeljenje pozivfunkcije Član se zamjenjuje pozivom funkcije Faktor .

U slučaju poređenja koristi se instrukcija FCOMPP, kao na slici Sl. 9.4.2. Instrukcija FCOMPP poredi brojeve navrhu steka, ali rezultat smješta u koprocesorske flegove. Da bi se ovi flegovi mogli testirati, instrukcijom FSTFW AX se onismještaju u AX registar, a zatim instrukcijom SAHF prebacuju u F registar.

Instrukcija SETE se mijenja zavisno od relacijskog operatora u

'=': SETE AL

'>': SETA AL

'<': SETB AL '#': SETNE AL

Zanimljivo je da instrukcija FSTFW AX pakuje flegove tako da izgleda kao da se FP operacije poredenepredznačeno, iako je u pitanju predznačeno poređenje.

Sl. 9.4.2. Generisanje koda za poređenje dva realna broja

9.5. Realne varijable

Uvođenje dva nova tipa, realni i realni * , zahtijeva redefiniciju pojma ImeTipa :

Ime tipa:

Sl. 9.5.1. Ime tipaČitanje sadržaja realne varijable se obavlja koristeći sljedeće dvije instrukcije, od kojih je jedna već poznata

LEA EBX,adresa

FLD QWORD PTR [EBX]

karakter

cijeli

*

*

realni *

Pozovi Izraz

Ako je prvi član cijeli broj ili karakter generiši PUSH EAX inače pozovi FPUStekNaStek

Pozovi IzrazAko je prvi član cijeli broj ili karakter generiši POP EBX

Ako nijedan član nije realan broj, generiši kod kao i ranije, prema tablicama izprethodnog poglavlja

Ako je drugi član cijeli broj ili karakter a prvi član je bio realni broj pozoviCijeliNaFPStek za registar EAX

Ako je prvi član cijeli broj ili karakter a drugi član je bio realni broj pozoviCijeliNaFPStek za registar EBX

Ako je prvi član realni pozovi StekNaFPUStek

Generiši FCOMPPGeneriši FSTSW AX

Generiši SAHF

Generiši SETE ALGeneriši AND EAX,0FFh

Page 54: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

54Međutim, kada je riječ o dodjeli vrijednosti varijabli instrukcija FLD sa lijeve strane operatora dodjeljivanja je ne

samo nepotrebna, nego i štetna jer ostavlja na FP steku konstantu i tako ga prepunjava. Pošto se unaprijed ne zna da li slijediznak dodjeljivanja, ovo se mora neutralisati instrukcijom FSTP ST(0). Stoga se dodjela vrijednosti, kada figurišu i realnevarijable, obavlja kodom sa slike Sl. 9.5.2:

Sl. 9.5.2. Sl. 9.5.3. Sl. 9.5.4.

Sl. 9.5.5. Generisanje koda za dodjeljivanje vrijednosti realnim promjenjivim

9.6. Funkcije realnog argumenta i unarni operatori

Analognim pravilima konverzije tipova se proširuje i poziv funkcije. Svaki realni parametar na steku zauzima po 8bajtova i umjesto prostog generisanja PUSH EAX instrukcije (slučaj ostalih tipova), ovdje se poziva proceduraFPUStekNaStek. Ako je na mjestu realnog parametra u pozivu proslijeđena cjelobrojna ili karakter varijabla, prije pozivaprocedure FPUStekNaStek treba pozvati CijeliNaFPStek sa parametrom EAX, što će konvertovati cijeli broj u realni.Ukoliko se realna vrijednost prosljeđuje cjelobrojnom parametru, treba pozvati FPStekUCijeli prije generisanja instrukcijaPUSH EAX.

Samo tri unarna operatora operatora imaju smisla u radu s realnim brojevima. To su -, & i * . Unarni minus treba dageneriše instrukciju FCHS koja mijenja predznak broja na vrhu FP steka. Operator adrese pored promjene tipa, poreduobičajene MOV EAX,EBX instrukcije treba da uništi broj na vrhu FP steka koristeći FSTP ST(0) instrukciju. Operatorvrijednosti na koju pointer pokazuje za tip realni * ,umjesto instrukcije MOV EAX,[EBX] , treba generisati instrukcije FSTPST(0) i FLD QWORD PTR [EBX].

Za razliku od Fortran-a, Pascal-a i BASIC-a, transcendentne funkcije nisu sastavni dio ovog jezika. One se moguprosto dodati u naknadno napisanim bibliotekama.

Minorna izmjena je potrebna u Entry stub dijelu generisanog koda. Mašina koja se podrazumijeva je 486, umjesto386, te je potrebno inicijalizirati koprocesor instrukcijom FINIT, i dodati pomoćnu lokaciju INTTOFP DD 0.

Sada je moguće napisati šestu verziju kompajlera, koja je data u prilogu 6.

9.7. Testni primjer

Primjer programa u šestoj verziji jezika je jedna od numeričkih metoda. Metodom sekante (koja radi uekstrapolacionom i interpolacionom režimu rada) se rješava jednačina

02 =−x . Kod ove metode naredna tačka se dobija formulom

)()()(

1

11

−+ −

−−=

kk

kkkkk xfxf

xxxfxx

Funkcija čija se nula traži navodi se unutar tijela funkcije f. Treba primijetiti da je funkcija sqrt napisana kaoasemblerski potprogram, jer je to sa ovim procesorom jednostavnije i brže od vlastite implementacije Heronovog algoritma.Funkcija Prikazidecimalnibroj prikazuje broj na 5 decimala, tako što već poznatom funkcijom Prikazibroj ispiše cijeli, azatim razlomljeni dio izraza. Kompajliranje ovog primjera se vrši na uobičajeni način, s tim što mu je ime sekanta.jez.

Pozovi Izraz

Prijavi grešku ako izraz nije dodjeljiv

Generiši PUSH EBXAko je prvi izraz realni broj generiši FSTP ST(0)

Pozovi IzrazDodjeljivanja

Generiši POP EBXAko je drugi izraz cijeli broj ili karakter a prvi član je bio realni broj pozovi

CijeliNaFPStek za registar EAX

Ako je prvi izraz cijeli broj ili karakter a drugi član je bio realni broj pozovi FPStekUCijeliza registar EAX

Ako je prvi izraz karakter generiši MOV [EBX],AL

Ako je prvi izraz realni broj generiši FSTP QWORD PTR [EBX]Ako je prvi izraz cijeli broj generiši MOV [EBX],EAX

Page 55: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

55

cijeli funkcija GetStdHandle(cijeli brhan);cijeli funkcija WriteConsoleA(cijeli rez,cijeli * u pisano, cijeli upisati,karakter * bafer,cijeli han);cijeli funkcija ReadConsoleA(cijeli rez,cijeli * up isano, cijeli upisati,karakter * bafer,cijeli han);

cijeli * ime;

cijeli funkcija Prikazistring (karakter * poruka){ cijeli handle,priv,duz; handle:=GetStdHandle(-11); duz:=0; dok (poruka[duz]#0) { duz:=duz+1;} WriteConsoleA(0,&priv,duz,poruka,handle);}

cijeli funkcija Novired () { karakter * dvoznak; dvoznak:=" "; dvoznak[0]:=13; dvoznak[1]:=10; Prikazistring(dvoznak);}

cijeli funkcija Prikazibroj (cijeli broj){ cijeli cifra,negativan,pokazivac,ostatak; karakter * bafer; bafer:=" "; ` Alociramo bafer cifra:=broj;` Negativne brojeve oznaci indikatorom ako (cifra<0) { negativan:=1; cifra:=-cifra; } inace { negativan:=0; }

`maksimalno 9 cifara pokazivac:=9; ako (cifra=0) { bafer[pokazivac]:='0'; pokazivac:=pokazivac-1; } dok (cifra>0) { ostatak:=(cifra % 10); `ostatke dijeljenja u b afer bafer[pokazivac]:=ostatak+'0'; cifra:=cifra/10; ` stalno dijeli s 10 pokazivac:=pokazivac-1; } ako (negativan=1) { bafer[pokazivac]:='-'; pokazivac:=pokazivac-1; } bafer:=&(bafer[pokazivac+1]);` Pomjeri pokazivac pocetka stringa Prikazistring(bafer);}

realni funkcija abs(realni x){ ako (x>0) { x;} inace {-x;}}

realni funkcija sqrt(realni x){ asembler FLD QWORD PTR [EBP+8] FSQRT\}

cijeli funkcija Prikazidecimalnibroj(realni x){ cijeli c,nn,q; realni o; c:=x; o:=abs(x-c); Prikazibroj(c); Prikazistring("."); nn:=100000*o; q:=10; dok q<100000 { ako (nn<q) {Prikazistring("0");} q:=q*10; } Prikazibroj(nn); Novired();}

realni funkcija f(realni x){ sqrt(x)-2;}

cijeli funkcija Racun(){ realni x,predx,novix; cijeli i,q; i:=0; predx:=0; x:=1; dok ( (i<2000) & (abs(x-predx) >0.000001) ) {

novix:=x-(f(x)*(x-predx))/(f(x)-f(predx)); predx:=x; x:=novix; Prikazidecimalnibroj(x); i:=i+1; }}

{ Racun();}----------------------------Rezultat

2.000003.414214.089184.003414.000024.000004.00000

Sl. 9.7.1. Primjer Metoda sekante

9.8. Rezime poglavlja

Zahvaljujući ugrađenom matematičkom koprocesoru dodavanje realne aritmetike je razmjerno jednostavno. Realnekonstante se prosto prosljeđuju asembleru jer svi moderni asembleri poznaju eksponencijalnu sintaksu. Koprocesor radi naprincipu steka i potrebne su konverzione procedure između koprocesorskog steka i cjelobrojnih registara.

Page 56: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

56Prilog 6: Verzija izvornog koda kompajlera br. 6program Kompajler;const MAXIDENT = 1024; MAXDIM = 10; DUGAKONST = 'Konstanta prevazilazi liniju'; REALKONST = 'Realna konstanta'; OCEKIVANO = 'Ocekivano '; REDEKLAR = 'Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG = 'Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ = 'Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator';

type TVrsta = (funkcija, lokalna, globalna, parametar); TTip = (karakter, cijeli, realni, pkarakter, pcijeli, prealni); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; end;

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija, aktnivo: integer; znak: char; linija, realnakonstanta: string; TabIdent: array[0..MAXIDENT] of TIdent; ukupnoident: integer; t: TTip; dod: Boolean;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; end;end;

procedure NovaLabela(var ImeLabele: string);begin

trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; realnakonstanta := ''; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak = '.') or (znak = 'e') or (znak = 'E') then begin if znak = '.' then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); while (znak >= '0') and (znak <= '9') do begin realnakonstanta :=realnakonstanta + znak; NoviSvaki(false); end; end;

if (znak = 'e') or (znak = 'E') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); if (znak = '+') or (znak = '-') then begin realnakonstanta :=realnakonstanta + znak; NoviSvaki(false); end; if (znak < '0') or (znak > '9') then Greska(REALKONST); while (znak >= '0') and (znak <= '9') do begin realnakonstanta :=realnakonstanta + znak; NoviSvaki(false); end; end; UzmiKonstantu := 0; t := realni; end else begin UzmiKonstantu := rezultat; t := cijeli; end; if (znak = ' ') or (znak = '`') then Novi; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true; if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;begin TipDek := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; Novi end else tip := stip; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then

Page 57: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

57 a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); if not (a) then a := TipDek('realni', tip, realni, prealni); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;begin case tip of cijeli, pcijeli, pkarakter, prealni: DuzinaTipa := 4; karakter: DuzinaTipa := 1; realni: DuzinaTipa := 8; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 4: Uslov := (TabIdent[n].nivo = nivo) and (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta =parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja

(var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean);var t1: TTip;begin Novi; Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; prealni: begin Emit(' FSTP ST(0)'); Emit(' SAL EAX,3'); t := realni; end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]') else Emit(' MOV EAX,[EBX]'); end; IdiDo(']'); dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure CijeliNaFPStek(reg: string; osmobitni: Boolean);begin if osmobitni then Emit(' AND ' + reg + ',0FFh'); Emit(' MOV INTTOFP,' + reg); Emit(' FILD DWORD PTR INTTOFP');end;

procedure FPStekUCijeli(reg: string);begin Emit(' ADD ESP,-4'); Emit(' FISTP DWORD PTR [ESP]'); Emit(' POP ' + reg);end;

procedure CPUStekCijeliNaFPStek(osmobitni: Boolean);begin if osmobitni then Emit(' AND DWORD PTR [ESP],0FFh'); Emit(' FILD DWORD PTR [ESP]'); Emit(' ADD ESP,4');end;

procedure FPUStekNaStek;

begin Emit(' ADD ESP,-8'); Emit(' FSTP QWORD PTR [ESP]');end;

procedure StekNaFPUStek;begin Emit(' FLD QWORD PTR [ESP]'); Emit(' ADD ESP,8');end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if (t1 in [karakter, realni]) and (t2 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); case t2 of realni: begin velsteka := velsteka + 8; case t1 of realni: ; karakter: CijeliNaFPStek('EAX', true); else CijeliNaFPStek('EAX', false); end; FPUStekNaStek; end else begin velsteka := velsteka + 4; if t1 = realni then FPStekUCijeli('EAX'); Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh0');end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end;

Page 58: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

58 case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); cijeli: Emit(' MOV EAX,[EBX]'); else Emit(' MOV EAX,[EBX]'); end; dod := true; if znak = '[' then PokazivacINiz(t, dod);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer; st, fpkonst, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NEG EAX'); realni: Emit(' FCHS'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter ; realni: begin t := prealni; Emit(' FSTP ST(0)'); end; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); if t = prealni then begin Emit(' FSTP ST(0)'); Emit(' FLD QWORD PTR [EBX]'); end else Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; prealni: t := realni; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli;

end; '"': begin StringKonstanta(t, dod); end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); case t of cijeli: begin Str(rezultat, st); Emit(' MOV EAX,' + st); end; realni: begin NovaLabela(fpkonst); Emit('.DATA'); st := 'L' + fpkonst + ' DQ '+ realnakonstanta; Emit(st); Emit('.CODE'); Emit(' FLD L' + fpkonst); end; end; end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end;end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; Novi; Faktor(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(POGRMNOZ); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '*': Emit(' FMUL '); '/': Emit(' FDIVR ');

else Greska(NEDOPFP); end end else begin t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Clan(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(NEDOPARIT); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '+': Emit(' FADD '); '-': Emit(' FSUBR '); else Greska(NEDOPFP); end end else begin case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX');

Page 59: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

59 Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; end; t1 := t; end;end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean;begin Izraz(t1, dod1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); if (t1 = realni) then Emit(' FSTP ST(0)'); Novi; IzrazDodjeljivanja(t2, dod); Emit(' POP EBX'); if (t2 in [karakter, realni]) and (t1 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = realni) and (t2 <> realni) then CijeliNaFPStek('EAX', t2 = karakter); if (t1 <> realni) and (t2 = realni) then FPStekUCijeli('EAX'); case t1 of karakter: Emit(' MOV [EBX],AL'); realni: Emit(' FSTP QWORD PTR [EBX]'); else Emit(' MOV [EBX],EAX'); end; t := t1; end; {:} '=', '>', '<', '#': begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Izraz(t2, dod); if t1 <> realni then Emit(' POP EBX'); if (t1 = realni) or (t2 = realni) then begin if t2 <> realni then

CijeliNaFPStek('EAX', t2 = karakter);

if t1 <> realni then CijeliNaFPStek('EBX', t1 = karakter) else StekNaFPUStek; Emit(' FCOMPP '); Emit(' FSTSW AX'); Emit(' SAHF'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETA AL'); '<': Emit(' SETB AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh');

t := cijeli; end else begin if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod);

if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip) - 1) div 4 + 1) * 4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, 0); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta = parametar) then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, 0);

Page 60: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

60 imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4) <> 0 do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st); Emit(ImeFunkcije + '@' + st + ':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC ' + ImeFunkcije + '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;

procedure Prevedi;var globadresa: Integer;

ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin Emit('.486'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' FINIT'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, 0); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end;

IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB ' + st + ' DUP(0)'); Emit('INTTOFP DD 0'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin trenlabela := 0; ukupnoident := 0; aktnivo := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 61: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

61

10. SLOŽENI TIPOVI PODATAKA

Dosadašnje smještanje nizova, definisanih preko pointera, u statički navedene stringove prilično ograničava veličinukoju niz može da ima. Iako se taj problem može prevazići primjenom API funkcije GlobalAlloc, i dalje se osjeća nedostatakdefinisanih nizova određene veličine u samom programskom jeziku. Pored ovoga, treba uvesti i višedimenzionalne nizove.Drugi složeni tip koji treba uvesti su slogovi (strukture u C-u), tj. skup podataka različitog tipa pod istim imenom. Konačno, dabi bilo moguće praviti Windows aplikacije koje rade u grafičkom okruženju, neophodno je i uvesti pointere na funkcije ili nekidrugi način da se funkcija može pozvati, iako se u trenutku kompajliranja ne zna o kojoj je funkciji riječ. Kombinovano saslogovima, to je i korak ka jeziku koji omogućava objektno orijentisano programiranje.

10.1. Višedimenzionalni nizovi

Deklarisanje višedimenzionalnih nizova se vrši navođenjem broja elemenata svake dimenzije iza oznake tipa, pričemu je donji indeks nizova uvijek 0. Npr.,

cijeli [2,3] a;

će rezervisati prostor za cijele brojeve a[0,0] a[0,1] a[0,2] a[1,0] a[1,1] i a[1,2] .

Jedan ili više pozitivnih cijelih brojeva razdvojenih zarezima unutar uglastih zagrada naziva se deklaracionidimenzijski modifikator. Jedan ili više numeričkih izraza razdvojenih zarezima unutar uglastih zagrada naziva se lista indeksa.Sintaksno se mogu predstaviti kao na slici Sl. 10.1.1

Deklaracioni dimenzijski modifikator Lista indeksa

Sl. 10.1.1. Deklaracioni dimenzijski modifikator i lista indeksaAdresa početka elementa jednodimenzionalnog niza se dobija formulom

AdresaElementa=AdresaPočetkaNiza+Index*VeličinaElementaNiza

Za dvodimenzionalne nizove ova formula iznosi

AdresaElementa=AdresaPočetkaNiza+(BrojElemenataDrugeDimenzije*IndexPrveDimenzije+IndexDrugeDimenzije)*VeličinaElementaNiza

Za trodimenzionalne nizove ova formula iznosi

AdresaElementa=AdresaPočetkaNiza+(BrojElemenataDrugeDimenzije*BrojElemenataTrećeDimenzije*IndexPrveDimenzije+ BrojElemenataTrećeDimenzije*IndexDrugeDimenzije+IndexTrećeDimenzije)*VeličinaElementaNiza

Formula se može generalizovati

AdresaElementa=AdresaPočetkaNiza+(Indexn+∑((i=1,n-1,Indexi)*∏(j=i+1,n,BrojElemenataj)))VeličinaElementa

ili generisati kodom sa slike Sl. 10.1.2, (koji će svoje mjesto naći u proceduri PokazivacINiz ) uz pretpostavku daregistar EBX sadrži adresu početka niza

Sl. 10.1.2. Pseudokod i generisanje mašinskog koda za račun elementavišedimenzionalnog niza

KonstantaIzrazdodjeljivanja

,

[ ]

,

[ ]

Generiši MOV EAX,0

Povećaj brojač dimenzija

Generisi PUSH EAX Pozovi IzrazDodjeljivanja

Generisi POP EBX

Ako nije zadnji indeks generiši MOV DX,ProizvodBrojElemenataNarednihDimenzija igeneriši MUL EDX

Generiši ADD EBX,EAX

Generiši MOV EAX,EBXGeneriši množenje EAX sa veličinom elementa

Page 62: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

62

Preuzima se koncept iz C-a da su nizovi i pointeri kompatibilni kada se prenose kao parametri, pri čemu se nizu nemože dodijeliti vrijednost, iako je sintaksa višedimenzionalnih nizova drugačija. Za niz se alocira onoliko bajtova koliki jeproizvod svih dimenzija pomnožen sa veličinom pojedinačnog argumenta, a za pointer četiri bajta. Da bi se znalo kolikoprostora treba alocirati, u slog tabele TabIdent dodaje se broj dimenzija niza i broj elemenata u svakoj dimenziji. Ovaj sadržajse kopira u globalni niz dimenzije i varijablu ukdim po potrebi. Shodno ovom proširuje se procedura DuzinaTipa.

U dosadašnjim verzijama kompajlera iza imena varijable mogao je biti opcionalni indeks niza. Sada, kada se dodajuvišedimenzionalni nizovi, slogovi i indirektni pozivi funkcija, jezički pojam varijabla izgleda kao na slici Sl. 10.1.3.

Varijabla:

Sl. 10.1.3. VarijablaMale zagrade iza imena varijable omogućavaju indirektni poziv funkcije.

10.2. Indirektni poziv funkcije

Pointerskoj varijabli moguće je dodijeliti ime funkcije, čime ona pokazuje na potprogram. Kada se iza pointerskevarijable stave zagrade, tada će se generisati poziv potprograma takav da adresa na koju se skače nije konstantna, nego se čita sdruge adrese. Kôd koji se generiše koristeći novu proceduru IndirektniPoziv izgleda kao na slici Sl. 10.2.1.

Sl. 10.2.1. Generisanje koda za indirektni poziv funkcijeProcedura IndirektniPoziv je jako slična proceduri PozivFunkcije, osim što ne provjerava tip i broj argumenata

prilikom generisanja poziva funkcije. Dosadašnja funkcija PozivFunkcije uključuje i varijantu kada iza imena funkcije neslijede zagrade. Tada se u EAX registru vraća adresa početka funkcije.

Tip rezultata koji vraćaju indirektno pozvane funkcije je dereferencirani tip varijable u kojoj se nalazi adresa funkcije.Na primjer, ako je varijabli koja je pokazivač na realni broj dodijeljena adresa funkcije, ova funkcija će vratiti realni broj.

Indirektni pozivi funkcija su moćan mehanizam koji treba koristiti sa velikim oprezom pošto mala greška može lakoda dovede do kraha programa. Iako se argumenti ne provjeravaju prilikom indirektnog poziva, funkcije normalno prihvaćajusamo onaj broj i tip argumenata koliko ih ima u deklaraciji. Ukoliko je funkcija pozvana sa drugačijim brojem argumenata odočekivanog, stek pointer neće biti u ispravnom položaju i to će izazvati krah. S druge strane, kako ECX registar u trenutkupoziva funkcije sadrži veličinu memorije koju su zauzeli argumenti, uz pomoć asemblerskih modula moguće je pravitifunkcije sa promjenjivim brojem argumenata.

Indirektni tip poziva omogućava uzajamnu rekurziju, tj. da funkcija P poziva funkciju Q, a funkcija Q da pozivafunkciju P. To se postiže tako da se prije definicije funkcija definišu dvije pointerske varijable, unutar samih funkcija poziv

Identifikator [ Lista indeksa

Izrazdodjeljivanja

,

()

Generiši labelu i lokaciju na kojoj se smješta duga riječ, npr L15 DD (?)

Generiši MOV L15,EAX

Za svaki izraz do zatvorene zagrade pozovi IzrazDodjeljivanja i odgovarajuće smještanje podatakana stek

Generiši MOV ECX,velicinasteka

Generiši indirektni poziv CALL L15

Page 63: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

63uzajamno rekurzivnih vrši koristeći indirektni poziv, a dodjela adresa funkcija pointerskim varijablama obavi na početkuglavnog programa.

10.3. Slogovi

Slogovi se definišu rekurzivno, jer član sloga može biti novi slog, kao i niz, odnosno matrica, a također su mogućinizovi slogova. U mnogim programskim jezicima svaka slogovska struktura predstavlja poseban tip. Kako jezik FILDZAN-32nema korisničkih tipova, sve varijable koje predstavljaju slogove su tipa slog, a kao numerička oznaka pojedine slogovskestrukture koristi se polje pod3 u tabeli identifikatora.

Dodavanje tipa slog zahtijeva izmjenu jezičkog pojma ImeTipa, što je prikazano na slici uz odgovarajuće promjenefunkcija TipDek i SlijediDekTipa. Dio koda iz procedure Varijabla , koji generiše kôd za čitanje sadržaja pointerskihvarijabli prebačen je u proceduru PEmit da se izbjegne njegovo dupliranje nakon uvođenja pointera na slogove.

ImeTipa:

Sl. 10.3.1. Jezički pojam ImeTipa

Jezički pojam Deklaracija sloga, implementiran u proceduri DeklaracijaSloga izgleda kao na slici Sl. 10.3.2.

Sl. 10.3.2. Deklaracija slogaPrimjer:

slog

{ cijeli x1,y1;

cijeli x2,y2; karakter[80] poruka;

} texbox;Implementacija deklaracije sloga, prikazana na slici Sl. 10.3.3 u osnovi dodaje u tabelu identifikatora za svako polje u

slogu novi identifikator pri čemu se za vrstu identifikatora navodi polje. Dodatni podaci koji se navode u tabeli slogova suoznaka sloga, oznaka podsloga i relativna pozicija polja u bajtima od početka sloga.

karakter *Deklaracionidimenzijskimodifikator

realni *Deklaracionidimenzijskimodifikator

cijeli *Deklaracionidimenzijskimodifikator

slog *Deklaracionidimenzijskimodifikator

Deklaracijasloga

{ ImeTipa Identifikatorimena polja

,

;

}

Page 64: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

64

Sl. 10.3.3. Aktivnosti pri deklarisanju sloga, pseudokodCijeli slog (tj. varijabla slogovnog tipa) ima svoju poziciju u tabeli identifikatora, u koju se upisuje prilikom

deklaracije varijable ili parametara funkcije. OznakaSloga nije ta pozicija, nego redni broj deklarisanog sloga koji se svaki putkada započne deklarisanje novog sloga ili podsloga, uvećava za jedan.

Varijabla zadnji čuva podatke o zadnjem definisanom ili upotrijebljenom slogu. Ti podaci su njegova dužina, rednibroj sloga po redoslijedu deklarisanja i pozicija u tabeli identifikatora gdje se nalazi njegovo ime. Pomoću varijable zadnjiprevaziđen je problem različite strukture različitih slogova. Procedura DuzinaTipa će za slogove vratiti dužinu zadnjegdefinisanog ili upotrijebljenog sloga. U proceduri varijabla se provjeri da li je u pitanju niz/matrica slogova. Ako jeste, dužinatipa se dijeli sa ukupnim brojem elemenata.

Pretraživač identifikatora NadjiIdent treba da traži poziciju polja u tabeli identifikatora. Do sada rezervisani, tippretraživanja 3 će obaviti ovaj zadatak.

Nad slogovima je dopušteno od operacija samo dodjeljivanje čitavog sloga drugom slogu. Kako konkretna slogovnastruktura nema imena uzeta je konvencija da se slog može dodijeliti drugom slogu samo ako su jednake dužine. Dodjela slogaslogu ili stavljanje sloga na stek se vrši naredbom REP MOVSB. Prije ove naredbe, ESI treba da pokazuje na izvorni slog, EDIna odredišni ili mjesto na vrhu steka, ECX na dužinu sloga, a direction flag treba biti jednak 0.

Na slici Sl. 10.3.4 dat je generisani kôd za smještanje sloga na stek i dodjeljivanje jedne slogovne varijable drugoj.

MOV ECX,duzinasloga SUB ESP,duzinasloga MOV ESI,EBX MOV EDI,ESP CLD REP MOVSB

Smještanje sloga na stek

PUSH EBX Izraz dodjeljivanja POP EDI MOV ESI,EBX CLD MOV ECX,duzina sloga REP MOVSB

Dodjeljivanje slogovnih varijabliSl. 10.3.4. Generisanje koda za operacije sa kompletnim slogovima

Implementacija elementa sloga, tj. adrese i vrijednosti polja, navedena u proceduri ElementSloga je sličnaimplementaciji varijabli, osim što se nakon dobijanja adrese varijable (cijelog sloga) u EBX registru, generiše instrukcija ADDEBX,pozicijapolja, kako bi registar EBX pokazivao na početak samog polja.

Realizacija elementa sloga zahtijeva izmjenu jezičkog pojma Faktor Sl. 10.3.5. Na kraj ovog jezičkog pojma sedodaje pojam ElementSloga ukoliko se na kraju pojma Faktor nalazi simbol “.”. Napomena: Ovo je izmijenjeno u odnosu naprethodno izdanje skripte (gdje je element sloga bio iza varijable) kako bi se moglo pristupiti elementu sloga na koji pokazujepointer.

Povećaj ukupni broj slogova za jedan i postavi dužinu sloga na nulu.

Za svaki tip koji se pojavljuje u deklaraciji sloga

(*) Ako je tip slog ili pointer na slog, podslog se dobija rekurzivnim pozivomdeklaracije sloga, a za proste tipove podslog je sam slog.

Preuzmi ime identifikatora polja.

Potraži da li već postoji takav identifikator u tablici identifikatora za taj nivo i tuoznaku sloga i ako ima prijavi grešku.

Upiši ime polja u tablicu identifikatora zajedno sa oznakom podsloga i samogsloga, te trenutnom duzinom sloga.

Uvećaj dužinu sloga za dužinu tipa

Sve dok slijedi znak ‘,’ vrati se na tačku (*)Dužinu sloga poravnaj na vrijednost djeljivu sa 4.

Očekuj simbol ‘;’Ako nema više tipova, očekuj simbol ‘}’.

Page 65: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

65

Sl. 10.3.5. Jezički pojam Faktor

Kako element sloga može takođe biti slog, jezički pojam ElementSloga treba da ponavljagenerisanje adresa za pristup podpoljima i njegova struktura izgleda kao na slici Sl. 10.3.6

Sl. 10.3.6. Jezički pojam ElementSloga

( Izraz dodjeljivanja )

Numerička konstanta

Faktor*

&

~

!

-

Varijabla

" String

Poziv funkcije

‘ Slovo ‘

. Elementsloga

Identifikatorimena polja

.

Page 66: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

66

10.4. Testni primjer

Primjer programa u ovoj verziji jezika je jedna jednostavna Windows GUI aplikacija. Program generiše osnovniprozor na kome se nalaze tri dugmeta, od kojih pritisak na jedno aktivira poruku na ekranu, drugo pokreće aplikaciju Solitaire,a treće crta jedan krug na ekranu.

Počevši od treće verzije jezika svi dosadašnji primjeri su bile Windows konzolne aplikacije, tj. aplikacije koje koristetekstualni korisnički interfejs i nemaju reakcija na asinhrone događaje kao što je pritisak na miša ili preklapanje izmeđuprozora/procesa.

Windows GUI aplikacije, s druge strane, primaju poruke u red čekanja i odgovaraju na njih. To se obično vršiprimjenom GetMessage i DispatchMessage API funkcija koje čitaju poruku i pozivaju odgovarajući potprogram da se porukaobradi.

Potprogram za obradu poruke (koja je zapravo jedan slog), je definisan u opisu tzv. klase prozora, u njenom poljulpfnWndProc . Klasa prozora predstavlja slog koji se ili popunjava pri startu programa ili uzima već gotov (kao što je“BUTTON”). Tu klasu navodimo prilikom kreiranja prozora, kao jedan od parametara funkcije CreateWindow.

Glavni prozor odgovara na tri vrste poruka, otvaranje programa (kada kreira podprozore koji su zapravo dugmad),zatvaranje prozora (kada šalje poruku koja završava GetMessage/DispatchMessage petlju) i komandu (kada zavisno odpodprozora koji ju je poslao poziva funkciju MessageBox za ispis poruke, WinExec za start programa ili Ellipse za prikazelipse čiji je specijalni slučaj krug).

Prozori se međusobno identifikuju konstantom koja se zove rukovatelj prozora (handle). Pored toga, prikaz elipsezahtijeva konstantu device context kao jedan od parametara, koji se uzima funkcijom GetDC.

Detaljniji opis ovoga primjera oduzeo bi dosta prostora. O načinu programiranja za Windows pogledati u referenci[PETZOLD-01] .

Program se prevodi sa:

komp32v7 wincircle.jez wincircle.asm

ml /c /coff /Fl wincircle.asm | more

link /defaultlib: user32.lib kernel32.lib gdi32.lib /subsystem:windows wincircle.objČinjenica da ovaj primjer radi, pokazuje da je jezik već dovoljno moćan da se u njemu, uz dosta truda, realizuje bilo

koja aplikacija koja koristi standardni Windows API . Interesantno je da je prevedeni EXE kôd dosta kratak, svega 4608bajtova, iako još nije implementirana optimizacija koda. U većini drugih programskih jezika, sem asemblera, ovaj primjer biimao veći prevedeni kôd: od 12 kilobajta (Delphi u Object Pascal režimu) do nekoliko megabajta (neki vizuelni alati kojizahtijevaju veliki runtime, npr. Oracle Forms)

Page 67: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

67

cijeli funkcija RegisterClassExA(cijeli * wndclass) ;cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, ci jelic,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,c ijeli c,cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija GetStockObject ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijelic,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b ,karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c );cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli funkcija GetDC ( cijeli a) ;cijeli funkcija Ellipse (cijeli a, cijeli b, cijeli c,cijelid,cijeli e);cijeli funkcija ReleaseDC (cijeli a, cijeli b);

cijeli hWnd ;cijeli ka,kb,kc;slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } msg ; ` a message structure

slog { cijeli cbsize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wndclass ; ` window class structure

cijeli nCmdShow;karakter * lpszCmdLine;cijeli hPrevInstance;cijeli hInstance;karakter[30] pstr;cijeli funkcija WndProc(cijeli lParam,cijeli wParam ,cijeliwMessage,cijeli hWnd) { cijeli obradjena,WSCHILD,WSVISIBLE,hDC;

obradjena:=0; ako (wMessage=1) `WM_CREATE { WSCHILD := 1073741824; `$40000000; WSVISIBLE := 268435456; `$10000000; ka:=CreateWindowExA (0,hInstance,0,hWnd, 40,120,20,140, WSCHILD | WSVISIBLE,"Poruka","BUTTON",0 ); kb:=CreateWindowExA (0,hInstance,0,hWnd,

40,120,60,140, WSCHILD | WSVISIBLE,"Soliter","BUTTON", 0); kc:=CreateWindowExA (0,hInstance,0,hWnd, 40,120,100,140, WSCHILD | WSVISIBLE,"Krug","BUTTON",0);

obradjena:=1;

}

ako (wMessage=2) `WM_DESTROY { PostQuitMessage (0) ; obradjena:=1; }

ako (wMessage=273) `WM_COMMAND {

ako (lParam=ka) { MessageBoxA (0,"Poruka","Pritisnut tast er",0); } ako (lParam=kb) { WinExec (" ","c:\windows\sol.exe"); } ako (lParam=kc) { hDC:=GetDC (hWnd); Ellipse(200,200,0,0,hDC); ReleaseDC(hDC,hWnd); }

obradjena:=1; }

ako (obradjena=0) { DefWindowProcA (lParam,wParam,wMessage,hW nd) ; } }

{ nCmdShow:=10; hInstance:=GetModuleHandleA (0); wndclass.cbsize:=48; wndclass.style := 0 ; wndclass.lpfnWndProc := WndProc ; wndclass.cbClsExtra := 0 ; wndclass.cbWndExtra := 0 ; wndclass.hInstance := hInstance ; wndclass.hIcon := 0 ; wndclass.hCursor := LoadCursorA (32512,0) ;`IDC_ARROW wndclass.hbrBackground := GetStockObject(2); wndclass.lpszMenuName := 0; wndclass.lpszClassName := "PROBNA" ; wndclass.hIconSm:=0; ako (!(RegisterClassExA (&wndclass))) { 0 ; } inace { hWnd := CreateWindowExA ( 0,hInstance,0,0, 400,400,4,4,13565952, `WS_OVERLAPPEDWINDOW "Prim","PROBNA",512); ShowWindow ( nCmdShow,hWnd) ; UpdateWindow(hWnd) ; dok (GetMessageA (0, 0, 0,&msg)) { TranslateMessage (&msg) ; DispatchMessageA (&msg) ; } msg.wParam ; } }

Sl. 10.4.1. Windows grafička aplikacija

10.5. Rezime poglavlja

Višedimenzionalni nizovi zahtijevaju nešto složeniji algoritam pristupa odgovarajućem elementu niza odjednodimenzionalnih. Pojam varijable je proširen tako da može da predstavlja i element višedimenzionalnog niza, polje slogaili da predstavlja adresu funkcije koja se može indirektno pozvati navođenjem argumenata u zagradi iza imena varijable.Indirektni poziv predstavlja CALL instrukciju na adresu koja je navedena u pointerskoj varijabli. Slogovi se sastoje od poljakoja se upisuju u tabelu identifikatora, ali i svaki definisani slog ima svoju oznaku. Uvijek se pamti koji je zadnji definisani ilikorišteni slog. U sadašnjoj verziji jezika moguće je pisati i grafičke aplikacije.

Page 68: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

68Prilog 7: Verzija izvornog koda kompajlera br. 7program Kompajler;const MAXIDENT = 1024; MAXDIM = 10; DUGAKONST = 'Konstanta prevazilazi liniju'; REALKONST = 'Realna konstanta'; OCEKIVANO = 'Ocekivano '; REDEKLAR='Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG='Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ ='Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator'; MAXDIMOV ='Maksimalan broj dimenzija'; INDSTATC = 'Indeks statickog niza nije cijeli'; PREVDIM = 'Prevazidjen broj dimenzija'; NESLDIM = 'Ne slaze se broj dimenzija'; POLJEPOS = 'Polje vec postoji'; SLOGPOLJE = 'Samo slogovi mogu imati polja'; NEDEKPOLJE = 'Nedeklarisano polje'; SLOGSLOGU = 'Slog se moze dodijeliti samoslogu'; SLOGRAZDUZ = 'Slogovi razlicite duzine'; INDNOPOINT = 'Indirektna funkcija bez pointera'; SLOGNEPOR = 'Slogovi se ne mogu porediti';

type TVrsta = (funkcija, lokalna, globalna, parametar, polje); TTip = (karakter, cijeli, realni, slog, pkarakter, pcijeli, prealni, pslog); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; ukupdim: integer; dim: array[0..MAXDIM] of integer; end;

TZadnjiSlog = record duzina: integer; pozimena: integer; idopisasloga: integer end;

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija, aktnivo: integer; znak: char; linija, realnakonstanta: string; TabIdent: array[0..MAXIDENT] of TIdent; ukupnoident, ukupnoslogova, ukdim: integer; t: TTip; dod: Boolean;

zadnji: TZadnjiSlog; dimenzije: array[0..MAXDIM]of integer;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);var i: integer ;begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; ukupdim := ukdim; for i := 0 to MAXDIM do dim[i] := dimenzije[i]; end;end;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;

end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; realnakonstanta := ''; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak = '.') or (znak = 'e') or (znak = 'E') then begin if znak = '.' then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); while (znak >= '0') and (znak <= '9') do begin realnakonstanta:=realnakonstanta + znak; NoviSvaki(false); end; end; if (znak = 'e') or (znak = 'E') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); if (znak = '+') or (znak = '-') then begin realnakonstanta:=realnakonstanta + znak; NoviSvaki(false); end; if (znak<'0')or(znak>'9') then Greska(REALKONST); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta+ znak; NoviSvaki(false); end; end; UzmiKonstantu := 0; t := realni; end else begin UzmiKonstantu := rezultat; t := cijeli; end; if (znak = ' ') or (znak = '`') then Novi; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true; if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end

Page 69: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

69 else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;var tipind: TTip; kraj, x, poi: Boolean;begin TipDek := false; poi := false; if Slijedi(imetipa, false) then begin TipDek := true ; Novi; if znak = '*' then begin tip := ptip; poi := true; Novi end else tip := stip; ukdim := 0; if znak = '[' then begin if poi then tip := pcijeli else tip := ptip; IdiDo('['); repeat ukdim := ukdim + 1; if ukdim > MAXDIM then Greska(MAXDIMOV); dimenzije[ukdim] := UzmiKonstantu(tipind, x); if tipind <> cijeli then Greska(INDSTATC); kraj := true; if znak = ',' then begin Novi; kraj := false; end; until kraj; IdiDo(']'); end; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); if not (a) then a := TipDek('realni', tip, realni, prealni); if not (a) then a := TipDek('slog', tip, slog, pslog); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;var elem, i: integer;begin case tip of cijeli: DuzinaTipa := 4; pcijeli, pkarakter, prealni, pslog: begin if ukdim = 0 then DuzinaTipa := 4 else begin elem := 4 * ord(tip = pcijeli) + 1 * ord(tip = pkarakter) + 8 * ord(tip = prealni) + zadnji.duzina * ord(tip = pslog); for i := 1 to ukdim do elem := elem * dimenzije[i]; DuzinaTipa := elem; end end; karakter: DuzinaTipa := 1;

realni: DuzinaTipa := 8; slog: DuzinaTipa := zadnji.duzina; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 3: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta = polje) and (TabIdent[n].nivo = nivo) and (TabIdent[n].pod3 = p1); 4: Uslov := (TabIdent[n].nivo = nivo) and (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta =parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean); forward;procedure Blok; forward ;

procedure PokazivacINiz(var t: TTip; var dod: Boolean; idpoz: Integer);var t1: TTip; navdim,dsvedim,i: Integer; st: string;begin navdim := 0;

Emit(' PUSH EAX'); Emit(' MOV EAX,0'); repeat Novi; navdim := navdim + 1; if navdim > MAXDIM then Greska(PREVDIM); Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); if znak = ',' then begin dsvedim:=1; for i:=navdim+1 to TabIdent[idpoz].ukupdim do dsvedim:=dsvedim* TabIdent[idpoz].dim[ i ]; Str(dsvedim, st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; Emit(' ADD EBX,EAX'); Emit(' MOV EAX,EBX'); until znak <> ','; Emit(' POP EBX'); if (navdim <> TabIdent[idpoz].ukupdim) and (not ((navdim = 1) and (TabIdent[idpoz].ukupdim = 0))) then Greska(NESLDIM); IdiDo(']'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; prealni: begin Emit(' FSTP ST(0)'); Emit(' SAL EAX,3'); t := realni; end; pslog: begin t := slog; Str(DuzinaTipa(t), st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]') else Emit(' MOV EAX,[EBX]'); end; dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure PEmit(idpoz: Integer);var i: integer;begin if TabIdent[idpoz].ukupdim = 0 then Emit(' MOV EAX,[EBX]')

Page 70: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

70 else Emit(' MOV EAX,EBX'); ukdim := TabIdent[idpoz].ukupdim; for i := 0 to MAXDIM do dimenzije[i] := TabIdent[idpoz].dim[i];end;

function DeklaracijaSloga(nivo: integer): integer;var ImePolja: string; oznakasloga, podslog, duzinasloga, zapukdim, i, poz: integer; tip: TTip; imaistogtipa: Boolean; zdimenzije: array[0..MAXDIM] of integer;begin zapukdim := ukdim; for i := 0 to MAXDIM do zdimenzije[i] := dimenzije[i]; IdiDo('{'); ukupnoslogova := ukupnoslogova + 1; oznakasloga := ukupnoslogova; duzinasloga := 0; poz := 0; while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then podslog := DeklaracijaSloga(nivo) else podslog := oznakasloga; repeat UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, podslog); if poz <> 0 then Greska(POLJEPOS); NoviIdent(ImePolja, DuzinaTipa(tip), 0, nivo, polje, tip, podslog, duzinasloga, oznakasloga); duzinasloga := duzinasloga + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (duzinasloga mod 4) <> 0 do duzinasloga := duzinasloga + 1; IdiDo(';'); end; IdiDo('}'); zadnji.duzina := duzinasloga; zadnji.pozimena := poz; zadnji.idopisasloga := OznakaSloga; DeklaracijaSloga := OznakaSloga; ukdim := zapukdim; for i := 0 to MAXDIM do dimenzije[i] := zdimenzije[i];end;

procedure ElementSloga (idpoz: integer; var t: TTip; var dod: Boolean);var poz, nivo, idsloga: integer; Imepolja, st: string;begin if t <> slog then Greska(SLOGPOLJE); nivo := TabIdent[idpoz].nivo; idsloga := TabIdent[idpoz].pod3; while znak = '.' do begin Novi; UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, idsloga); if poz = 0 then Greska(NEDEKPOLJE); Str(TabIdent[poz].pod2, st); Emit(' ADD EBX,' + st); t := TabIdent[poz].tip; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin idsloga := TabIdent[poz].pod1; zadnji.duzina :=

TabIdent[poz].duzina; zadnji.pozimena := poz; zadnji.idopisasloga := TabIdent[poz].pod3; end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(poz); end; end;end;

procedure CijeliNaFPStek(reg: string; osmobitni: Boolean);begin if osmobitni then Emit(' AND ' + reg + ',0FFh'); Emit(' MOV INTTOFP,' + reg); Emit(' FILD DWORD PTR INTTOFP');end;

procedure FPStekUCijeli(reg: string);begin Emit(' ADD ESP,-4'); Emit(' FISTP DWORD PTR [ESP]'); Emit(' POP ' + reg);end;

procedure CPUStekCijeliNaFPStek(osmobitni: Boolean);begin if osmobitni then Emit(' AND DWORD PTR [ESP],0FFh'); Emit(' FILD DWORD PTR [ESP]'); Emit(' ADD ESP,4');end;

procedure FPUStekNaStek;begin Emit(' ADD ESP,-8'); Emit(' FSTP QWORD PTR [ESP]');end;

procedure StekNaFPUStek;begin Emit(' FLD QWORD PTR [ESP]'); Emit(' ADD ESP,8');end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka, duzprvogsloga, duzdrugogsloga, m1: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; duzprvogsloga := 0; duzdrugogsloga := 0; if znak <> '(' then begin velsteka := 0; for parametara := 1 to TabIdent[idpoz].pod1 do begin n := NadjiIdent('', idpoz, 4, parametara); velsteka := velsteka + ( (TabIdent[n].duzina - 1) div 4 + 1) * 4; end; Str(velsteka, st); Emit(' MOV EAX,OFFSET ' + imefunkcije + '@' + st); t := pcijeli; dod := false; end else begin IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip;

if t2 = slog then duzdrugogsloga := TabIdent[n].duzina; if (t1 in [karakter, realni]) and (t2 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); case t2 of slog: begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); m1 := ((duzprvogsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; case t1 of realni: ; karakter: CijeliNaFPStek('EAX', true); else CijeliNaFPStek('EAX', false); end; FPUStekNaStek; end else begin velsteka := velsteka + 4; if t1 = realni then FPStekUCijeli('EAX'); Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh'); end;end;procedure IndirektniPoziv(var t: TTip);var m1, velsteka, duzsloga: Integer; straddr, st: string; t1: TTip;begin velsteka := 0; NovaLabela(straddr); Emit('.DATA'); st := 'L' + straddr + ' DD ?'; Emit(st); Emit('.CODE'); Emit(' MOV L' + straddr + ',EAX'); IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); case t1 of slog: begin duzsloga := DuzinaTipa(t1); m1 := ((duzsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzsloga, st); Emit(' MOV ECX,' + st); Str(m1, st);

Page 71: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

71 Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; FPUStekNaStek; end else begin velsteka := velsteka + 4; Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL L' + straddr); case t of pcijeli: t := cijeli; prealni: t := realni; pkarakter: t := karakter; pslog: t := slog; else Greska(INDNOPOINT) end;end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin zadnji.duzina := TabIdent[idpoz].duzina; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; end; pslog: begin rezultat:=1; for i:=1 to TabIdent[idpoz].

ukupdim do rezultat:=rezultat* TabIdent[idpoz].dim[i]; if rezultat<>0 then

zadnji.duzina :=TabIdent[idpoz].duzinadiv rezultat

else zadnji.duzina:=4; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; PEmit(idpoz); end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(idpoz); end; if TabIdent[idpoz].ukupdim = 0 then dod := true else dod := false; while znak ='[' do begin PokazivacINiz(t, dod, idpoz); end; if znak = '(' then IndirektniPoziv(t);end;

procedure Faktor(var t: TTip; var dod:

Boolean);var rezultat, poz: integer; st, fpkonst, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NEG EAX'); realni: Emit(' FCHS'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; slog: t := pslog; realni: begin t := prealni; Emit(' FSTP ST(0)'); end; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); if t = prealni then begin Emit(' FSTP ST(0)'); Emit(' FLD QWORD PTR [EBX]'); end else Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; prealni: t := realni; pslog: begin t := slog; end; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod); end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo('''');

t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); case t of cijeli: begin Str(rezultat, st); Emit(' MOV EAX,' + st); end; realni: begin NovaLabela(fpkonst); Emit('.DATA'); st := 'L' + fpkonst + ' DQ '+ realnakonstanta; Emit(st); Emit('.CODE'); Emit(' FLD L' + fpkonst); end; end; end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end; if znak = '.' then ElementSloga(zadnji.pozimena,t,dod);end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; Novi; Faktor(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(POGRMNOZ); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '*': Emit(' FMUL '); '/': Emit(' FDIVR '); else Greska(NEDOPFP); end end else begin t := cijeli; case z of '*': begin

Page 72: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

72 Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Clan(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(NEDOPARIT); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '+': Emit(' FADD '); '-': Emit(' FSUBR '); else Greska(NEDOPFP); end end else begin case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli;

if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; end; t1 := t; end;end;procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean; duzprvogsloga, duzdrugogsloga: Integer; st: string;begin duzprvogsloga := 0; duzdrugogsloga := 0; Izraz(t1, dod1); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); if (t1 = realni) then Emit(' FSTP ST(0)'); Novi; IzrazDodjeljivanja(t2, dod); if t2 = slog then duzdrugogsloga := DuzinaTipa(t2); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); if t1 = slog then begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); Emit(' POP EDI'); Emit(' MOV ESI,EBX'); Emit(' CLD'); Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); end else Emit(' POP EBX'); if (t2 in [karakter, realni]) and (t1 in [pkarakter, pcijeli, prealni]) then Greska(DODJPOINT); if (t1 = realni) and (t2 <> realni) then CijeliNaFPStek('EAX', t2 = karakter); if (t1 <> realni) and (t2 = realni) then FPStekUCijeli('EAX'); case t1 of karakter: Emit(' MOV [EBX],AL'); realni: Emit(' FSTP QWORD PTR [EBX]'); slog: Emit(' REP MOVSB');

else Emit(' MOV [EBX],EAX'); end; t := t1; end; {:} '=', '>', '<', '#': begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Izraz(t2, dod); if (t1 = slog) or (t2 = slog) then Greska(SLOGNEPOR); if t1 <> realni then Emit(' POP EBX'); if (t1 = realni) or (t2 = realni) then begin if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CijeliNaFPStek('EBX', t1 = karakter) else StekNaFPUStek; Emit(' FCOMPP '); Emit(' FSTSW AX'); Emit(' SAHF'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETA AL'); '<': Emit(' SETB AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end else begin if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end end;end;procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija);

Page 73: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

73 if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i, p3: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1;

paradresa := paradresa + ((DuzinaTipa(tip)-1)div 4+1)*4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, p3); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta=parametar)then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara ; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, p3); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4)<>0do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st); Emit(ImeFunkcije+'@'+st+':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC '+ImeFunkcije+ '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;procedure Prevedi;var globadresa, p3: Integer; ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin

Emit('.486'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' FINIT'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(0) else p3 := 0; repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, p3); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB '+st+' DUP(0)'); Emit('INTTOFP DD 0'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;procedure Glavni;var linija: string;begin trenlabela := 0; ukupnoident := 0; aktnivo := 0; ukupnoslogova := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;begin Glavniend .

Page 74: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

74

11. PREDPROCESIRANJE I OPTIMIZACIJA KODA

Došlo se do faze u kojoj se sam kompajler više neće mijenjati. Uočljivo je, međutim, da jeziku nedostaju predefinisanitipovi, konstante te makronaredbe, odnosno uključivanje kompletnih datoteka izvornog koda, kako se iste sekvence koda ne bimorale više puta kucati. Svi ovi problemi se mogu riješiti predprocesorom. Osim toga, već u prvoj verziji kompajlera je uočenoda je generisani kôd prevelik, pa je potrebno pristupiti optimizaciji generisanog koda.

11.1. Struktura kompajlera

Predprocesor i postprocesor se nalaze u posebnim modulima (unit) i u suštini predstavljaju velika proširenjadosadašnjih procedura Novi i Emit . Ove procedure su premještene iz glavnog modula u module predpr8.pas i postpr8.pas.Posljednja verzija kompajlera nema oznaka izmjena u odnosu na prethodnu verziju

11.2. Predprocesorska direktiva #definiraj

Predprocesor je sličan predprocesoru iz jezika C. Ako se na početku linije nalazi znak #, to predstavljapredprocesorsku direktivu. Tipična sintaksa direktive #definiraj izgleda ovako:

#definiraj SIMBOL TekstSimbolaU daljnjem radu prilikom obrade linije sve pojave navedenog simbola zamjenjuju se tekstom. Ako je tekst simbola

duži od jedne linije, na njenom kraju se stavlja znak \.

Primjer:

#definiraj PI 3.14159265

#definiraj PETLJA dok(i<2)\ { i:=i+1;}

U ovom primjeru je definisana konstanta PI i sada je u korisničkom programu moguće pisati a:=PI/2. Pored ovoganavođenjem simbola PETLJA, zamjenjuje se cijela petlja navedena u njegovom tijelu.

Definisanje konstanti predprocesorom rješava pitanje imena tipova. Tako se može navesti:

#definiraj KOMPLEKSNI slog {realni x;realni i;}

i dalje pisati

KOMPLEKSNI a,b,c,d;

Uz pomoć predprocesora, čak je moguće uvesti objekte sa jednim nivoom nasljeđivanja. Na slici Sl. 11.2.1 se vidikako se uz pomoć predprocesora može, uz dosta discipline pri pisanju, postići sintaksa slična sintaksi u objektno orijentisanimjezicima, tj. “metode” (u suštini pointeri na funkcije) , “klase” (zapravo slogovi) i “nasljeđivanje” (ponavljanje istih polja uzpomoć predprocesora).

Sl. 11.2.1. Rudimentarno OOP uz pomoć predprocesora

11.3. Direktive uslovnog kompajliranja

U jeziku FILDZAN-32 omogućeno je da se određeni dijelovi koda kompajliraju ako je neki simbol definisan (ilinedefiniran) koristeći direktivu #definiraj . U protivnom, linije izvornog koda se ignorišu kao da su komentari. Direktiveuslovnog kompajliranja su #postoji, #nepostoji i #dalje.

• #postoji SIMBOLAko je navedeni simbol ranije definisan, naredni dio programa će se prevoditi, a ako ne ignorisat će se. Ovo

ignorisanje će ići sve do direktive #dalje

• #nepostoji SIMBOLAko navedeni simbol nije ranije definisan, naredni dio programa će se prevoditi, a ako je definisan ignorisat će se.

Ovo ignorisanje će ići sve do direktive #dalje

• #daljeZavršava blok započet naredbama #postoji ili #nepostoji.

#definiraj METODA cijeli *#definiraj OTAC cijeli p1,p2; METODA a;#definiraj SIN OTAC cijeli p3;#definiraj OBJEKT slog {#definiraj INSTANCE }#definiraj INIT .a:=x;cijeli funkcija x (cijeli a){ 1;` tijelo metode}

OBJEKT OTAC INSTANCE xxx;OBJEKT SIN INSTANCE yyy;{ xxx INIT yyy INIT xxx.p1:=2; yyy.p1:=3; yyy.p3:=3; xxx.a(50);}

Page 75: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

75

Sl. 11.3.1. Upotreba direktiva #postoji i #nepostojiU primjeru sa slike Sl. 11.3.1 se, ako je definisan simbol WINDOWS, prikazuje poruka koristeći funkciju

MessageBox, a ako ne, poruka se upisuje u datoteku.

11.4. Direktiva #dodaj za uključivanje datoteke

Sintaksa naredbe za uključivanje kompletne datoteke sa izvornim kodom glasi:

#dodaj ImeDatotekeOd mjesta u izvornom kodu programa neposredno iza direktive #dodaj se uključuje kompletna datoteka i sada se

generiše asemblerski kôd iz te datoteke, sve dok se ona ne iscrpi. Nakon toga se nastavlja kompajliranje glavne datoteke. Nijedopušteno gniježđenje datoteka

Primjer:

#dodaj osnovniprozor.h

11.5. Realizacija predprocesora

Realizacija predprocesora nije pretjerano složena. Treba definisati bafer od (npr.) 200 K u kome će stojati stringovikoji predstavljaju vrijednost koja se stavlja i niz definicija koje sadrže imena simbola te poziciju u ovom baferu gdje se nalazidati string.

Procedura Novi sada izgleda nešto drugačije nego u sedmoj verziji kompajlera. Kako se direktivom #dodaj možepreusmjeriti na drugu ulaznu datoteku, provjerava se koja je ulazna datoteka u pitanju i ReadLn obavlja iz nje. Nakoninstrukcije ReadLn se poziva rutina Predprocesiraj. U okviru ove rutine se provjerava da li linija počinje predprocesorskomdirektivom.

Najviše posla ima ako se prepozna direktiva #definiraj. Ona je implementirana u proceduri PpDefin i najprije rastaviime simbola od njegove vrijednosti. Definisanje simbola se vrši njegovim dodavanjem u tabelu simbola, a njegova definicija sedodaje u bafer opisa simbola simbola.

Direktive #postoji i #nepostoji (implementirane u procedurama PpPostoji i PpNePostoji) provjeravaju prisustvonavedenog simbola u tabeli i tako postave varijablu ObradaLinije na true ili false. U rutini Predprocesiraj se ova varijablaprovjeri i ako je jednaka false, linija teksta se proglašava praznom. Direktiva #dalje (implementirana u Predprocesiraj)postavlja tu varijablu na true. Direktiva #dodaj (implementirana u Predprocesiraj) otvara pomoćnu datoteku i preusmjeravačitanje na nju.

U drugom dijelu rutine Predprocesiraj se prođe kroz cijelu tabelu predprocesorskih simbola i koristeći paskalskufunkciju Pos pretražuje pojava danih simbola u ulaznoj liniji. Ako ih ima, simbol na tom mjesto u izvornom kodu sezamjenjuje kompletnim stringom koji se nalazi u definiciji. Ako definicija simbola sadrži drugi simbol, ova će petljaekspandovati i njega.

Rutina se zasniva na činjenici da stringovi u 32-bitnim implementacijama Pascala mogu biti veoma dugački.Eventualno portiranje kompajlera u drugi programski jezik treba imati tu činjenicu u vidu.

Jezik FILDZAN-32 je završen, uključujući i predprocesor. U prilogu 9 dat je izvorni kôd predprocesora .

11.6. Optimizacija koda

Gledano makroskopski, ovaj kompajler generiše veoma kratak kôd. U usporedbi sa bilo kojim kompajlerom višihprogramskih jezika za Windows, koji u izvršni kôd uključuju velike biblioteke, manje od 3 Kb za prazan program izgledaskoro kao rekord. Razlog ovome je što FILDZAN-32 generiše vrlo mali startni kôd.

Ali, posmatrajući pojedinačne naredbe, kako su prevedene, uviđa se da ima jako mnogo nepotrebnih asemblerskihinstrukcija. Razlog ovome je što kompajler kada prevodi aritmetičke izraze prilikom nailaska na operator ne zna unaprijed da li

#definiraj WINDOWS 1

#postoji WINDOWS

MessageBox(0,”Poruka”,”Na ekranu”,0);#dalje

#nepostoji WINDOWS

UpisiUDatoteku(”Poruka”);#dalje

Page 76: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

76će slijediti konstanta, varijabla ili kompletan izraz, pa se priprema za najgori slučaj. To rezultuje vrlo čestim stavljanjempodataka na stek, ili pomoćne registre. Za primjer se može uzeti prevođenje proste instrukcije n:=n+1; Ona se prevodi u

; n:=n+1; LEA EBX,GLOBALV[400] MOV EAX,[EBX] PUSH EBX LEA EBX,GLOBALV[400] MOV EAX,[EBX] PUSH EAX MOV EAX,1 POP EBX ADD EAX,EBX POP EBX MOV [EBX],EAX

dok je najkraći mogući kôd

; n:=n+1; INC GLOBALV[400]

Uklanjanje nepotrebnih instrukcija se može izvesti modifikacijom procedure Emit . Umjesto da se generisanaasemblerska naredba odmah šalje u izlaznu datoteku, ona se najprije stavlja u bafer od 15 instrukcija. Kada se ovaj baferpopuni, prvo se traži nekoliko karakterističnih uzoraka sekvenci asemblerskih naredbi i one se pokušavaju zamijeniti kraćimsekvencama. Ako to ne uspije, naredba koja je najranije ušla u bafer se šalje u izlaznu datoteku i stvara se mjesto za novunaredbu u baferu. Ovo se zove peephole optimizacija. Prepozna li se pseudo instrukcija .END, optimizacija se izvede jošjednom i pošalju se u datoteku sve instrukcije iz bafera.

Prepoznavanje uzoraka je složen problem i zavisan od konkretnog procesora. Sekvenca koja je na procesoru 386 brža,može biti sporija na procesoru Pentium IV od neke druge sekvence. Ovaj zadatak prilično usporava kompajler, pa će serealizovati optimizovanje samo nekoliko najčešćih uzoraka.

Uzorci se sastoje od više instrukcija, a one mogu da sadrže parametre. Parametri se označavaju sa $C1, $C2 zaproizvoljne literale, ili sa $N1, $N2 za brojeve. Stoga se se uzorci ne mogu prepoznavati prostim poređenjem, nego je potrebnaodgovarajuća funkcija. Ta funkcija se zove Uzorak i ima četiri string parametra: string koji se traži, stvarna vrijednost,varijable u koje vraćamo vrijednosti prvog i drugog $ parametra u uzorku. Primjer

uzorak(‘ MOV EAX,$C1’,’ MOV EAX,ECX’,v1,v2) će vratiti true, jer su uzorci slični, u varijabli v1 se dobija string‘ECX’ dok v2 dobija prazan string.

Funkcija uzorak poredi uzorke algoritmom sa slike Sl. 11.6.1.

Sl. 11.6.1. Algoritam pretraživanja uzorkaObrada slučajeva za $C i $N sekvence realizovana je u procedurama KarakterSl i BrojSl .

Ako su traženi i stvarni string jednaki, odmah se vrati s tačnom vrijednošću

Postavi pokazivače na početak traženog i stvarnog stringa

Izvršavaj petlju do kraja traženog stringa

Ako se u traženom stringu na datom mjestu nalazi simbol $, uvećaj pokazivač utraženom stringu za 1, provjeri da li slijede simboli C ili N, a iza njih simboli 1 ili 2, oba putauvećavajući pokazivač u traženom stringu. Ukoliko se prepoznaju sekvence $C1, $C2, $N1 ili $N2treba ih specijalno obraditi. Specijalna obrada nadovezuje redom znakove stvarnog stringa, stalnouvećavajući njegov pokazivač, na prvu ili drugu izlaznu varijablu sve dok se ne dođe do krajastvarnog stringa, znaka zarez, a za numeričke konstante i prvog nenumeričkog znaka.

Ako su znakovi na trenutnoj poziciji u traženom i stvarnom stringu različiti, izađi izfunkcije s netačnim rezultatom.

Uvećaj za jedan pokazivače traženog i stvarnog stringa.

Na kraju petlje izađi iz funkcije sa tačnim rezultatom

Page 77: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

77

ADD $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

Ako je $C1 jednak ESP relativna promjena ESP je $C2

AND $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

CALL $C1 Pretpostavlja se da briše EAX, EBX i koristi FPU

CDQ Koristi EAX

CLD Irelevantna

CMP $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

FADD Koristi FPU

FCHS Koristi FPU

FCOMPP Koristi FPU

FDIVR Koristi FPU

FILD $C1 Koristi FPU

FINIT Koristi FPU

FISTP $C1 Koristi FPU

FLD $C1 Koristi FPU

FMUL Koristi FPU

FSTP $C1 Koristi FPU

FSTSW AX Koristi FPU, briše EAX

FSUBR Koristi FPU

IDIV $C1 Koristi EAX, ako je $C1 jednak EBX, koristi i EBX

IMUL $C1 Koristi EAX, ako je $C1 jednak EBX, koristi i EBX

JMP $C1 Pretpostavlja se da briše EAX, EBX i koristi FPU

JNE $C1 Pretpostavlja se da briše EAX, EBX i koristi FPU

LEA $C1,$C2 Ako je $C1 jednak EAX (AL) ili EBX (BL), briše ih. Ako $C2 sadrži EAX ili EBX, koristi ih.

MOV $C1,$C2 Ako je $C1 jednak EAX (AL) ili EBX (BL), briše ih. Ako $C2 sadrži EAX ili EBX, koristi ih. Ako $C1 sadrži EAX ili EBX, a nijejednak njima koristi ih.

MUL $C1 Koristi EAX, ako je $C1 jednak EBX, koristi i EBX

NEG $C1 Ako $C1 sadrži EAX ili EBX, koristi ih.

NOT $C1 Ako $C1 sadrži EAX ili EBX, koristi ih.

OR $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

POP $C1 Ako je $C1 jednak EAX ili EBX, briše ih. Relativna promjena ESP je -4

PUSH $C1 Ako $C1 sadrži EAX ili EBX, koristi ih. Relativna promjena ESP je –4

REP MOVSB Irelevantna

RET $N1 Relativna promjena ESP je $N1+4

SAHF Koristi EAX

SAL EAX,$N1 Koristi EAX

SETA AL Briše EAX

SETB AL Briše EAX

SETE AL Briše EAX

SETG AL Briše EAX

SETL AL Briše EAX

SETNE AL Briše EAX

SUB $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

XOR $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

Sl. 11.6.2. Efekti pojedinih instrukcija relevantni za optimizaciju

Page 78: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

78Da bi se znalo koje instrukcije iz peephole bafera je moguće izbaciti treba ažurirati sljedeće indikatore:

- Da li grupa instrukcija mijenja EAX prije nego ga čita

- Da li grupa instrukcija uopšte čita EAX

- Da li grupa instrukcija mijenja EBX prije nego ga čita

- Da li grupa instrukcija uopšte čita EBX

- Da li grupa instrukcija koristi floating point instrukcije

- Na kojoj se poziciji nalazi ESP registar u odnosu na početak grupe instrukcija

Procedura obradistanje za svaku od instrukcija koja joj se proslijedi ažurira navedenih šest indikatora.

Instrukcije koje su korištene za generisanje koda se mogu smjestiti u tabelu na slici Sl. 11.6.2 po njihovom ponašanju:

Optimizacijska pravila implementirana u osmoj verziji kompajlera su:

1) Sekvenca PUSH EAX / instrukcije koje ne mijenjaju EAX / POP EAX povlači izbacivanje PUSH EAX iPOP EAX instrukcija. Unutar ove sekvence ESP mora biti na istom nivou, dakle sekvenca mora imati jednakbroj PUSH i POP instrukcija. Dualno pravilo se primjenjuje ako se zamijene EAX i EBX.

2) Sekvenca PUSH EAX / instrukcije koje ne mijenjaju EBX / POP EBX povlači izbacivanje POP EBX izamjenu PUSH EAX instrukcije instrukcijom MOV EBX,EAX . Unutar ove sekvence ESP mora biti na istomnivou, dakle sekvenca mora imati jednak broj PUSH i POP instrukcija. Dualno pravilo se primjenjuje ako sezamijene EAX i EBX.

3) Sekvenca LEA EBX,adresa / PUSH EBX / instrukcije koje ne mijenjaju EBX / POP EBX povlačiizbacivanje LEA EBX,adresa i PUSH EBX te zamjenu POP EBX instrukcije instrukcijom LEA EBX,adresa.Unutar ove sekvence ESP mora biti na istom nivou, dakle sekvenca mora imati jednak broj PUSH i POPinstrukcija

4) Ako nakon instrukcije LEA EBX,adresa slijedi instrukcija koja briše EBX prije instrukcije koja ga koristi,instrukcija LEA EBX, adresa se može obrisati.

5) Ako nakon instrukcije MOV EAX,adresa slijedi instrukcija koja briše EAX prije instrukcije koja ga koristi,instrukcija MOV EAX, adresa se može obrisati. Dualno pravilo se primjenjuje ako se zamijene EAX i EBX.

6) Ako iza instrukcije FLD slijedi sekvenca instrukcija koje ne koriste FPU a nakon njih instrukcija FSTP ST(0)(odbacivanje podatka) instrukcije FLD i FSTP ST(0) se mogu obrisati.

7) U sekvenci ADD ESP,-8 / FSTP QWORD PTR [ESP] / Instrukcije koje ne koriste FPU/ FLD QWORDPTR [ESP] / ADD ESP,8 sve četiri instrukcije koje uokviruju ostale instrukcije se mogu brisati.

8) Instrukcije koje nemaju efekta kao što su MOV EAX,EAX ; MOV EBX,EBX ;ADD EAX,0 ili ADD EBX,0 semogu brisati

9) Ako su dvije uzastopne iste MOV instrukcije , jedna se može brisati

10) Ako iza MOV registar,konst slijedi ADD registar,konst ovo se može svesti na jednu MOV instrukciju kojadodjeljuje implicitni zbir

11) Ako iza instrukcije MOV registar,konst slijedi NEG registar, to se može zamijeniti sa MOV registar,-konst.Ovim je riješen problem unarnog minusa koji je u nekim jezicima sastavni dio konstante.

12) Ako su dvije uzastopne iste ADD instrukcije , mogu se svesti na jednu sa implicitnim zbirom

13) Sekvence tipa MOV reg1,reg2 / ADD reg3,reg1 / MOV reg1,reg3 se mijenjaju sekvencama ADD reg3,reg2 /MOV reg1,reg3. Umjesto registara ovdje se mogu javljati i memorijske lokacije, a pored ADD instrukcije istasekvenca je moguća i sa instrukcijama AND, SUB, MOV, OR, XOR.

14) Sekvence tipa PUSH reg1 / MOV reg2,reg3 / MOV reg1,reg4 / POP reg4 znače da se reg1 i reg4 moguobrisati. Ova sekvenca se javlja kao rezultat drugih optimizacija.

Procedura Optimizuj , koja se poziva iz procedure Emit provjerava sve ove slučajeve i izbacuje odnosno zamjenjujenepotrebne instrukcije.

Ovih 14 jednostavnih pravila skraćuju asemblerski generisani program za oko 30 %. Realizacija samog optimizatoraje nešto usložnjena kako bi pretraživanje išlo brže. Uvođenje optimizacije usporava proces kompajliranja. Sedma verzijakompajlera je prevodila prethodni primjer na Pentium-u 100 za 0,2 s, dok osmoj verziji za isti zadatak treba oko 2,5 s.

Page 79: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

7911.7. Testni primjer optimizacije

Kao testni primjer uzet je program predstavljen u prvoj koloni slike Sl. 11.7.1 :

cijeli a;{

a:=2;

a:=a+a+1;}

Izvornikôd

Neoptimizirani kôdiz 7. Verzijekompajlera

Uočene redundantesekvence

Optimizovani kôd iz 8. verzije

.486

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: FINIT JMP GLAVNI;;cijeli a;;{; a:=2;GLAVNI: MOV EAX,2 MOV DWORD PTR GLOBALV[0],EAX; a:=a+a+1; MOV EBX,DWORD PTR GLOBALV[0] MOV EAX,DWORD PTR GLOBALV[0] ADD EAX,EBX MOV EBX,EAX MOV EAX,1 ADD EAX,EBX MOV DWORD PTR GLOBALV[0],EAX;};} PUSH 0 CALL [email protected] DB 4 DUP(0)INTTOFP DD 0END ULAZ

Optimalni kôd

cijeli a;{ a:=2; a:=a+a+1;}

.486

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: FINIT JMP GLAVNI;cijeli a;;{; a:=2;GLAVNI: LEA EBX,GLOBALV[0] MOV EAX,[EBX] PUSH EBX MOV EAX,2 POP EBX MOV [EBX],EAX; a:=a+a+1; LEA EBX,GLOBALV[0] MOV EAX,[EBX] PUSH EBX LEA EBX,GLOBALV[0] MOV EAX,[EBX] PUSH EAX LEA EBX,GLOBALV[0] MOV EAX,[EBX] POP EBX ADD EAX,EBX PUSH EAX MOV EAX,1 POP EBX ADD EAX,EBX POP EBX MOV [EBX],EAX;};} PUSH 0 CALL [email protected] DB 4 DUP(0)INTTOFP DD 0END ULAZ

Nepotrebno MOV EAX13 MOV EAX,[EBX]14 PUSH EBX15 MOV EAX,2Nepotrebno LEA/PUSH/POP12 LEA EBX,GLOBALV[0]13 PUSH EBX14 MOV EAX,215 POP EBXNasao nepotrebno LEA12 LEA EBX,GLOBALV[0]13 MOV [EBX],EAX14; a:=a+a+1;15 LEA EBX,GLOBALV[0] Nepotrebno MOV EAX12 MOV EAX,[EBX]13 PUSH EBX14 LEA EBX,GLOBALV[0]15 MOV EAX,[EBX]Nasao nepotrebno LEA12 LEA EBX,GLOBALV[0]13 MOV EAX,[EBX]14 PUSH EAX15 LEA EBX,GLOBALV[0]Nasao nepotrebno LEA13 LEA EBX,GLOBALV[0]14 MOV EAX,[EBX]15 POP EBXNepotrebno PUSH /POP EBX12 PUSH EAX13 MOV EAX,DWORD PTRGLOBALV[0]14 POP EBXNepotrebna trojka11 MOV EAX,DWORD PTRGLOBALV[0]12 MOV EBX,EAX13 MOV EAX,DWORD PTRGLOBALV[0]Nepotrebno PUSH /POP EBX13 PUSH EAX14 MOV EAX,115 POP EBXNepotrebno LEA/PUSH/POP7 LEA EBX,GLOBALV[0]8 PUSH EBX9 MOV EBX,DWORD PTRGLOBALV[0]10 MOV EAX,DWORD PTRGLOBALV[0]11 ADD EAX,EBX12 MOV EBX,EAX13 MOV EAX,114 ADD EAX,EBX15 POP EBXNasao nepotrebno LEA10 LEA EBX,GLOBALV[0]11 MOV [EBX],EAX12;}13;}14 PUSH 015 CALL ExitProcess@4Prevedeno bez greske

.486

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: JMP GLAVNI;;cijeli a;;{; a:=2;GLAVNI: MOV DWORD PTR GLOBALV[0],2; a:=a+a+1; MOV EAX,DWORD PTR GLOBALV[0] ADD EAX,DWORD PTR GLOBALV[0] INC EAX MOV DWORD PTR GLOBALV[0],EAX;};} PUSH 0 CALL [email protected] DB 4 DUP(0)INTTOFP DD 0END ULAZ

Sl. 11.7.1. Primjer rada optimizatoraKada ne bi bilo optimizacije, (kao u verziji 7 kompajlera) prevedeni kôd bi izgledao kao u drugoj koloni. U

kompajleru je uključeno da prikazuje sekvence koje pronalazi optimizator nakon zaključka da se one mogu zamijeniti kraćimsekvencama. U trećoj koloni se vidi da je optimizator djelovao ukupno 11 puta u ovako malom programu.

Page 80: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

80Rezultat optimizacije je dat u gornjem dijelu četvrte kolone na slici Sl. 11.7.1. Ovo još nije najbolji kôd koji se može

generisati. Uz povećanje broja pravila (što u ovom radu nije učinjeno) može se približiti optimalnom kodu iz donjeg dijelačetvrte kolone.

I na većim programima uočavaju se uštede od oko 30%-40%, iako je implementirano prilično malo optimizacijskihpravila.

11.8. Rezime poglavlja

Predprocesor omogućava zamjenu dijelova koda konstantama, uključivanje čitavih listinga izvornog koda, te uslovnokompajliranje. Predprocesor je baziran na baferu u kome se čuvaju definicije zamjenskih simbola. Promijenjene su procedureNovi i Emit i projekt organizovan u tri modula. Optimizator radi na principu zadrške nekoliko instrukcija i traženjakarakterističnih sekvenci koje se zamjenjuju kraćim sekvencama. Pri izboru sekvenci prati se upotreba registara EAX, EBX,ESP i FP steka.

Ovim je razvoj jezika, na nivou ovog rada, završen. Sada treba isprobati nekoliko primjera iz realnog svijeta.

Page 81: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

81

12. TESTNI PRIMJERI

Nakon realizacije posljednje verzije kompajlera slijedi njegovo testiranje. Kompajler je isproban na aplikacijama izrealnog svijeta, iz raznih oblasti primjene.

12.1. Primjer: Baze podataka i korisnički interfejs

Pošto su baze podataka uz igre, obradu teksta i sistemski softver najpopularnija kategorija softvera, završni primjerprograma u jeziku FILDZAN-32 je mala baza podataka u Accessovom MDB formatu kojoj se pristupa koristeći SQL i ODBC.Ne bi bilo bitne razlike ni da je u pitanju MS SQL Server ili Oracle RDBMS. Sastoji se od jedne tabele koja predstavljatelefonski imenik. Imenik se može pretraživati, a u njega se mogu unositi podaci. Polja u tabeli IMENIK su

IME CHAR(20), PREZIME CHAR(20), ADRESA CHAR(20), TELEFON CHAR(20)

Ovaj database primjer koristi, pored Windows API funkcija navedenih u prethodnom poglavlju i mnoge API funkcijeiz oblasti ODBC-a. Konekcija sa ODBC sistemom se uspostavlja koristeći SQLAllocEnv, za pripremu okruženja,SQLAllocConnect za rezervisanje prostora u memoriji za konekciju, SQLDriverConnect koji zaista vrši konekciju sa datimsistemom za upravljanje bazom podataka. Prostor u memoriji za naredbu se rezerviše koristeći SQLAllocStmt, a oslobađa

koristeći SQLFreeStmt.

SQL Naredba se izvršava peko funkcije SQLExecDirect.Ako ona vraća podatke, slog se preuzima koristeći SQLFetch, aodgovarajuće polje se dobije funkcijom SQLGetData. Konekcija seprekida sa SQLDisconnect a memorija oslobađa saSQLFreeConnect.

Na slici se vidi prozor sa formularom za pretraživanje i unošenjenavedene baze podataka. Na njemu se nalaze četiri labele, četiri editnapolja i tri tastera.

Obrada poruka koje generišu ovi tasteri se vrši na standardan način,kao u primjeru iz prethodnog poglavlja

Sl. 12.1.1. Izgled ekrana demonstracione ODBC aplikacijeKompajliranje i linkovanje ovog primjera zahtijeva još jednu dodatnu biblioteku prilikom linkovanja.

komp32v7 odbc.jez odbc.asmml /c /coff /Fl odbc.asm

link /defaultlib: user32.lib kernel32.lib gdi32.lib odbc.lib /subsystem:windows odbc.obj

Datoteke odbc.jez i odbc.h sa finalnim primjerima date su na slikama Sl. 12.1.2 i Sl. 12.1.3.

Page 82: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

82

#dodaj odbc.hcijeli funkcija Konekcija(){ cijeli velicina,rez; karakter [2000] punistring; rez:=SQLAllocEnv(&ehan);

rez:=SQLAllocConnect(&chan,ehan); rez:=SQLDriverConnect(0,&velicina, 1900, punistri ng, 70,"DRIVER={Microsoft Access Driver(*.mdb)};DBQ=test.mdb",hWnd,chan); rez:=SQLAllocStmt(&shan,chan);}cijeli funkcija Diskonekcija(){ cijeli rez; rez:=SQLFreeStmt(0,shan); rez:=SQLDisconnect(chan); rez:=SQLFreeConnect(chan);}cijeli funkcija Insert(){ karakter [500] komanda; karakter * kk; karakter [30] polje; karakter [2] navodnik; cijeli rez; navodnik [0]:=39;navodnik[1]:=0; komanda[0]:=0; lstrcat("INSERT INTO IMENIK(IME,PREZIME,ADRESA,TELEFON) VAL UES(",komanda); GetWindowTextA(30,polje,ka); NAV;POLJE;NAV;ZAREZ; GetWindowTextA(30,polje,kb); NAV;POLJE;NAV;ZAREZ; GetWindowTextA(30,polje,kc); NAV;POLJE;NAV;ZAREZ; GetWindowTextA(30,polje,kd); NAV;POLJE;NAV; lstrcat(")",komanda); ako (lstrlenA(polje)>4) { Konekcija(); rez:=SQLExecDirect(lstrlenA(komanda),komanda,sh an); Diskonekcija(); } inace { MessageBoxA(0,"Greska","Kratak broj",0); }}cijeli funkcija Select(){ karakter[500] komanda; karakter [2] navodnik; karakter [30] polje; cijeli rez,indikator; navodnik [0]:=39;navodnik[1]:=0; komanda[0]:=0; lstrcat("SELECT IME,PREZIME,ADRESA,TELEFON FROM IMENIK WHERE 1=1 ",komanda); GetWindowTextA(30,polje,ka); ako (lstrlenA(polje))>1 { lstrcat(" AND IME=",komanda);NAV;POLJE;NAV; } GetWindowTextA(30,polje,kb); ako (lstrlenA(polje))>1 { lstrcat(" AND PREZIME=",komanda);NAV;POLJE;NAV; } GetWindowTextA(30,polje,kc); ako (lstrlenA(polje))>1 { lstrcat(" AND ADRESA=",komanda);NAV;POLJE;NAV; } GetWindowTextA(30,polje,kd); ako (lstrlenA(polje))>1 { lstrcat(" AND TELEFON=",komanda);NAV;POLJE;NAV; } Konekcija(); rez:=SQLExecDirect(lstrlenA(komanda),komanda,shan ); rez:=SQLFetch(shan); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,1,shan ); SetWindowTextA(polje,ka); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,2,shan ); SetWindowTextA(polje,kb); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,3,shan ); SetWindowTextA(polje,kc); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,4,shan ); SetWindowTextA(polje,kd); Diskonekcija();}cijeli funkcija PraznaForma() { karakter [1] prazna; prazna[0]:=0;

SetWindowTextA(prazna,ka); SetWindowTextA(prazna,kb); SetWindowTextA(prazna,kc); SetWindowTextA(prazna,kd); }

cijeli funkcija WndProc(cijeli lParam,cijeli wParam ,cijeliwMessage,cijeli hWnd) { cijeli obradjena; obradjena:=0; ako (wMessage=1) `WM_CREATE {ka:=CreateWindowExA(0,hInstance,0,hWnd,20,120,20,14 0, UOKVIRENO,0,"EDIT",0);kb:=CreateWindowExA(0,hInstance,0,hWnd,20,120,60,14 0, UOKVIRENO,0,"EDIT",0);kc:=CreateWindowExA(0,hInstance,0,hWnd,20,120,100,1 40,UOKVIRENO,0,"EDIT",0);kd:=CreateWindowExA(0,hInstance,0,hWnd,20,120,140,1 40,UOKVIRENO,0,"EDIT",0);ke:=CreateWindowExA(0,hInstance,0,hWnd,20,120,180,1 40,UOKVIRENO,"Nadji","BUTTON",0);kf:=CreateWindowExA(0,hInstance,0,hWnd,20,120,220,1 40,UOKVIRENO,"Unesi","BUTTON",0);kk:=CreateWindowExA(0,hInstance,0,hWnd,20,120,260,1 40,UOKVIRENO,"Prazna forma","BUTTON",0);kg:=CreateWindowExA (0,hInstance,0,hWnd,20,120,20,1 0, UOKVIRENO,"Ime ","STATIC",0);kh:=CreateWindowExA (0,hInstance,0,hWnd,20,120,60,1 0, UOKVIRENO,"Prezime ","STATIC",0);ki:=CreateWindowExA(0,hInstance,0,hWnd,20,120,100,1 0, UOKVIRENO,"Adresa ","STATIC",0);kj:=CreateWindowExA(0,hInstance,0,hWnd,20,120,140,1 0, UOKVIRENO,"Telefon ","STATIC",0); obradjena:=1; } ako (wMessage=2) `WM_QUIT {PostQuitMessage (0) ; obradjena:=1; } ako (wMessage=273) `WM_COMMAND { ako (lParam=ke) { Select(); } ako (lParam=kf) { Insert(); } ako (lParam=kk) { PraznaForma(); } obradjena:=1; } ako (obradjena=0) { DefWindowProcA lParam,wParam,wMessage,hWnd ); } }

{ nCmdShow:=10; hInstance:=GetModuleHandleA (0); wndclass.cbsize:=48; wndclass.style := 0 ; wndclass.lpfnWndProc := WndProc ; wndclass.cbClsExtra := 0 ; wndclass.cbWndExtra := 0 ; wndclass.hInstance := hInstance ; wndclass.hIcon := 0 ; wndclass.hCursor := LoadCursorA (32512,0) ; wndclass.hbrBackground := GetStockObject(3); wndclass.lpszMenuName := 0; wndclass.lpszClassName := "PROBNA" ; wndclass.hIconSm:=0; ako (!(RegisterClassExA (&wndclass))) { 0 ; } inace { hWnd := CreateWindowExA ( 0,hInstance,0,0, 400,400,4,4,13565952,"ODBC Database Demo","PROBNA",512); ShowWindow ( nCmdShow,hWnd) ; UpdateWindow(hWnd) ; dok (GetMessageA (0, 0, 0,&msg)) { TranslateMessage (&msg) ; DispatchMessageA (&msg) ; } msg.wParam ; } }

Sl. 12.1.2. Datoteka ODBC.JEZ

Page 83: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

83cijeli funkcija RegisterClassExA(cijeli * wndclass) ;cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, ci jelic,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,c ijeli c, cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijel i i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija GetStockObject ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijelic,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b ,karakter * c,cijeli d);cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli funkcija lstrcat ( karakter * a,karakter * b ) ;cijeli funkcija GetWindowTextA (cijeli a, karakter *b,cijeli c);cijeli funkcija SetWindowTextA (karakter * b,cijeli c);

cijeli funkcija SQLAllocEnv(cijeli * EnvironHandle) ;cijeli funkcija SQLAllocConnect(cijeli *ConnectionHandle,cijeli EnvironHandle);cijeli funkcija SQLDriverConnect(cijeliDriverCompletion,cijeli * StringLengthDPtr, cijeli BufferLength, cijeli * OutConnectionStri ng, cijeli StringLengthJ,cijeli * InConnectionStri ng,cijeliWindowHandle, cijeli ConnectionHandle);` DRIVER={Microsoft Access Driver (*.mdb)};DBQ=cijeli funkcija SQLAllocStmt(cijeli *StatementHandle,cijeli ConnectionHandle);cijeli funkcija SQLExecDirect(cijeli TextLen,cije li *StatementText,cijeli StatementHandle);cijeli funkcija SQLDisconnect(cijeli ConnectionHa ndle);cijeli funkcija SQLFreeConnect(cijeli ConnectionH andle);cijeli funkcija lstrlenA (karakter * a);cijeli funkcija wvsprintfA(realni * broj,karakter * format, karakter * bafer );cijeli funkcija SQLFreeStmt(cijeli fOption,cijeli h stmt);cijeli funkcija SQLFetch(cijeli StatementHandle);cijeli funkcija SQLGetData(cijeli * StrLenOrInd,cij eliBufferLength,

cijeli * TargetValue,cijeli TargetType,cijeliColumnNumber, cijeli StatementHandle);cijeli hWnd ;slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } msg ; ` a message structure

slog { cijeli cbsize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wndclass ; ` window class structure

cijeli nCmdShow;karakter * lpszCmdLine;cijeli hPrevInstance;cijeli hInstance;cijeli ka,kb,kc,kd,ke,kf,kg,kh,ki,kj,kk;cijeli ehan,chan,shan;

#definiraj UOKVIRENO 1350631424#definiraj NAV lstrcat(navodnik,komanda)#definiraj POLJE lstrcat(polje,komanda)#definiraj ZAREZ lstrcat(",",komanda)#definiraj SQLDRIVERPROMPT 2#definiraj SQLCHAR 1

Sl. 12.1.3. Datoteka ODBC.H

12.2. Primjer: Multimedija

Na slici Sl. 12.2.1 je dat prosti program koji šalje na zvučnik sadržaj WAV datoteke, koristeći funkciju PlaySound.Ovaj primjer ujedno ilustruje učitavanje dinamičkih biblioteka. Funkcija LoadLibraryA učitava cijelu dinamičku biblioteku,dok funkcija GetProcAddress vraća adresu pojedine procedure u njoj.

cijeli * PlaySound;cijeli funkcija LoadLibraryA(karakter * ime);cijeli funkcija GetProcAddress(karakter * ime,cijel i hl); cijeli hl;{

hl:=LoadLibraryA("WINMM.DLL"); PlaySound:=GetProcAddress("PlaySound",hl); PlaySound(131072,0,"c:\PJESMA.WAV");}

Sl. 12.2.1. Datoteka sound.jez

12.3. Primjer: Web Server

U jeziku FILDZAN-32 napisan je mali Web server, sposoban da prikazuje statičke web stranice sa hiperlinkovima, namašini, lokalnoj mreži ili Internetu. Web server koristi Winsock biblioteku, odnosno funkcije WSAStartup (inicijalizacijaokruženja), WSACleanup (uklanjanje okruženja), accept (prihvatanje konekcije i njeno povezivanje s soketom), closesocket(uklanjanje soketa iz tabele), send (slanje podataka prijemnom soketu) , recv (prijem podatka od drugog soketa), socket(kreiranje krajnje tačke za komunikaciju i vraćanje soketa), listen (slušanje da li u konekciji nailazi neki soket i bind (dodjelalokalnog imena neimenovanom soketu).

Listing programa dat je na slici Sl. 12.3.1. Princip Web servera je u suštini jednostavan. Nakon što je povezan soketda osluškuje port 80 (HTTP) očekuje se zahtjev od strane klijenta. U okviru ovog zahtjeva obično dolazi komanda GETpraćena imenom datoteke i verzijom protokola. Nakon parsiranja imena, otvara se datoteka sa tim imenom i njen sadržaj sepošalje klijentskom soketu koristeći funkciju send.

Page 84: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

84

#definiraj HTTPPORT 80#definiraj CETRSTOCETIRI "HTTP/1.1\ 404Content-Type: text/html \ <h1>Nemastranice</h1><hr><i>Ibrik\ Web Server,v1.0-(c) 2002-2003 by \ Kenan Kalajdzic"#definiraj CETRSTO "HTTP/1.1 400 \Content-Type: text/html <h1>Bad \Request</h1><hr><i>Ibrik Web \ Server,v1.0 - (c) 2002-2003 by \ KenanKalajdzic"#definiraj INDEXPAGE "/index.htm"#definiraj WEBDIR "D:/thp/%s"#definiraj METODLEN 16#definiraj PAGELEN 256#definiraj SOCKADDRIN slog { \karakter fam1,fam2,port1,port2; \cijeli inaddr; karakter [8] \sinzero; }#definiraj BUFSIZE 1024#definiraj SOCKET cijeli#definiraj SOCKSTREAM 1#definiraj SOCKETERROR (-1)#definiraj INVALIDSOCKET (~0)#definiraj INADDRANY 0#definiraj PFINET 2#definiraj STRADDRINLEN 16#definiraj FILEATTRIBUTENORMAL 128#definiraj OPENEXISTING 3#definiraj GENERICREAD 2147483648#definiraj INVALIDHANDLEVALUE (-1)#definiraj WSADATA slog { cijeli \ wVersion;\ cijeli wHighVersion;\ karakter [257] szDescription;\ karakter [129] szSystemStatus;\ cijeli iMaxSocketsiMaxUdpDg;\ karakter * lpVendorInfo;}SOCKET sd, newsd;cijeli f,imebr;cijeli wsVersion;cijeli bytes, pos;karakter [BUFSIZE] buf;karakter * ptr, ptr2 ;SOCKADDRIN sin, rhost; cijeli rlen;cijeli dalje,petlja;WSADATA wsaData;cijeli funkcija WSAStartup (cijeli *adr,cijeli ver);cijeli funkcija WSACleanup ();cijeli funkcija GetVersion ();cijeli funkcija accept(cijeli * a,cijeli* b,cijeli c);cijeli funkcija closesocket(cijelisocket);cijeli funkcija send(cijeli a, cijeli b,karakter * c,cijeli d);cijeli funkcija socket(cijeli a,cijelib,cijeli c);cijeli funkcija listen(cijeli a,cijelib);cijeli funkcija bind(cijeli a,cijeli *sockp,cijeli sock);cijeli funkcija wvsprintfA(cijeli *kom,karakter * fmt,karakter * dest);cijeli funkcija CreateFileA(cijelihTemplateFile, cijelidwFlagsAndAttributes,cijelidwCreationDisposition, karakter * lpSecurityAttributes, cijeli dwShareMode,cijelidwDesiredAccess,karakter * lpFileName,);cijeli funkcija ReadFile( cijelilpOverlapped, cijeli *lpNumberOfBytesRead, cijeli nNumberOfBytesToRead, cijeli *lpBuffer, cijeli hFile);cijeli funkcija CloseHandle(cijelihobject);cijeli funkcija MessageBoxA(cijeliopcije,karakter * poruka, karakter *naslov,cijeli handle);cijeli funkcijaExitProcess(cijeli kod);

cijeli funkcija recv(cijeli a,cijelib,cijeli * c,cijeli sock);cijeli funkcija lstrcmp(karakter *a,karakter * b);cijeli funkcija lstrcpy(karakter *a,karakter * b);slog { karakter [METODLEN] method; karakter [PAGELEN] page;} req;cijeli funkcija hasnewline(karakter *ptr){ cijeli ima,n; ima:=0; dok (* ptr # 0) & (ima =0) { ako (* ptr = 13) { * ptr := 0; ima:=1; } ptr:=&(ptr[1]); } n:=ima;}karakter * funkcija getstr(karakter *dest, karakter * src, cijeli max){ karakter * rez; karakter m; max := max-1; dok ( src[0] # ' ') & (max >0) { dest[0] := src[0]; src := &(src[1]); dest := &(dest[1]); max := max-1; } * dest := 0; rez := &(src[1]);}cijeli funkcija errexit(karakter *title){ MessageBoxA(0,"Upozorenje", title,0); WSACleanup(); ExitProcess(-1);}

{ ako (GetVersion() < 2147483648) { wsVersion := 2; ` Win NT } inace { wsVersion := 257; ` Win 9x } ako (WSAStartup (&wsaData,wsVersion )){ errexit("WSAStartup"); } sd:= socket(0,SOCKSTREAM,PFINET); ako (sd=INVALIDSOCKET) { errexit("socket"); } sin.fam1 := PFINET; sin.fam2 := 0; sin.port1 := 0; sin.port2 := HTTPPORT; sin.inaddr := INADDRANY; ako (bind(STRADDRINLEN,&sin,sd)= SOCKETERROR){ errexit("bind"); } ako (listen(1,sd)=SOCKETERROR) { errexit("listen"); } dok (1 ) { rlen := STRADDRINLEN; newsd:=accept(&rlen,&rhost,sd); ako (newsd= INVALIDSOCKET) { errexit("accept"); } pos := 0; bytes :=0; dok (bytes < BUFSIZE) { buf[bytes]:=0; bytes := bytes+1; }

petlja :=1; bytes := 1; dok (bytes # 0 ) & petlja { dalje:=1; bytes := recv(0,BUFSIZE-pos, &buf[pos], newsd); ako (bytes = SOCKETERROR) { ako (closesocket(newsd) = SOCKETERROR) { errexit("closesocket"); } dalje :=0; } ako(hasnewline(buf)&dalje) { dalje := 0; petlja := 0; } ako dalje { pos := pos+bytes; } } getstr( req.page, getstr(req.method, buf, METODLEN),PAGELEN); dalje :=1; ako (lstrcmp("GET", req.method)){ dalje :=1; send(0,100,CETRSTO,newsd); ako (closesocket(newsd) = SOCKETERROR) { errexit("closesocket"); } dalje := 0; } ako(!lstrcmp("/",req.page)& dalje) { lstrcpy(INDEXPAGE,req.page); } ako dalje { imebr:=req.page; imebr:=imebr+1; wvsprintfA(&imebr,WEBDIR,buf); f := CreateFileA(0, FILEATTRIBUTENORMAL, OPENEXISTING,0,0, GENERICREAD,buf); ako f = INVALIDHANDLEVALUE { send(0,80, CETRSTOCETIRI,newsd); ako (closesocket(newsd)<0){ errexit("closesocket"); } dalje:=0; } inace { petlja:=1; dok (petlja ) { ako (!ReadFile(0,&bytes, BUFSIZE,buf,f)) { petlja:=0; } ako (bytes = 0) { petlja:=0; } ako petlja { ako send(0,bytes,buf, newsd) =SOCKETERROR) { petlja:=0; } } } ako (!CloseHandle(f)) { errexit("CloseHandle"); } } ako (closesocket(newsd) = SOCKETERROR) { errexit("closesocket"); } } }}

Sl. 12.3.1. Web server

Page 85: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

85

12.4. Primjer: Numeri čka analiza

Pogledati primjer “Metoda sekante” na slici Sl. 9.7.1 s obzirom da se očuvala kompatibilnost sa tom verzijomkompajlera.

12.5. Rezime poglavlja

Završni primjeri pokazuju zrelost koju je jezik dostigao. Unatoč jednostavnom optimizatoru i kompajleru, izvršneverzije svih testnih programa su dužine ispod 10 kilobajta. Raznovrsnost oblasti a već odlično demonstrira da se ovimkompajlerom mogu praviti gotovo sve klasične aplikacije. Testni primjeri su poslužili za otkrivanje grešaka u kompajleru, ali ipokazali da je sa ovom verzijom jezika moguće praviti aplikacije iz oblasti korisničkog interfejsa, baza podataka, multimedije,dvodimenzionalne i trodimenzionalne grafike, lokalnih i globalnih mreža, numeričke analize i gotovo svih drugih oblastisoftvera. FILDZAN-32 definitivno nije najjednostavniji programski jezik za realizaciju ovih aplikacija, ali je jedan od rijetkihkoji pruža uvid u internu implementaciju softvera.

Page 86: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

86Prilog 8: Verzija izvornog koda kompajlera br. 8, glavni program

program Kompajler;uses predpr8, postpr8;const MAXIDENT = 1024; MAXDIM = 10; DUGAKONST = 'Konstanta prevazilazi liniju'; REALKONST = 'Realna konstanta'; OCEKIVANO = 'Ocekivano '; REDEKLAR = 'Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG = 'Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ = 'Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator'; MAXDIMOV = 'Maksimalan broj dimenzija'; INDSTATC = 'Indeks statickog niza nije cijeli'; PREVDIM = 'Prevazidjen broj dimenzija'; NESLDIM = 'Ne slaze se broj dimenzija'; POLJEPOS = 'Polje vec postoji'; SLOGPOLJE = 'Samo slogovi mogu imati polja'; NEDEKPOLJE = 'Nedeklarisano polje'; SLOGSLOGU = 'Slog se moze dodijeliti samoslogu'; SLOGRAZDUZ = 'Slogovi razlicite duzine'; INDNOPOINT = 'Indirektna funkcija bez pointera'; SLOGNEPOR = 'Slogovi se ne mogu porediti';

type TVrsta = (funkcija, lokalna, globalna, parametar, polje); TTip = (karakter, cijeli, realni, slog, pkarakter, pcijeli, prealni, pslog); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; ukupdim: integer; dim: array[0..MAXDIM] of integer; end;

TZadnjiSlog = record duzina: integer; pozimena: integer; idopisasloga: integer end;

var trenlabela, aktnivo: integer; realnakonstanta: string; TabIdent: array[0..MAXIDENT] of TIdent;

ukupnoident, ukupnoslogova, ukdim: integer; t: TTip; dod: Boolean; zadnji: TZadnjiSlog; dimenzije: array[0..MAXDIM] of integer;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);var i: integer;begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; ukupdim := ukdim; for i := 0 to MAXDIM do dim[i] := dimenzije[i]; end;end;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; realnakonstanta := ''; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak = '.') or (znak = 'e') or (znak = 'E') then begin if znak = '.' then begin realnakonstanta := realnakonstanta

+ znak; NoviSvaki(false); while (znak >= '0') and (znak <= '9') do begin realnakonstanta :=realnakonstanta + znak; NoviSvaki(false); end; end; if (znak = 'e') or (znak = 'E') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); if (znak = '+') or (znak = '-') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak < '0') or (znak > '9') then Greska(REALKONST); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; end; UzmiKonstantu := 0; t := realni; end else begin UzmiKonstantu := rezultat; t := cijeli; end; if (znak = ' ') or (znak = '`') then Novi; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true; if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;var tipind: TTip; kraj, x, poi: Boolean;begin TipDek := false; poi := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; poi := true; Novi

Page 87: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

87 end else tip := stip; ukdim := 0; if znak = '[' then begin if poi then tip := pcijeli else tip := ptip; IdiDo('['); repeat ukdim := ukdim + 1; if ukdim > MAXDIM then Greska(MAXDIMOV); dimenzije[ukdim] := UzmiKonstantu(tipind, x); if tipind <> cijeli then Greska(INDSTATC); kraj := true; if znak = ',' then begin Novi; kraj := false; end; until kraj; IdiDo(']'); end; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); if not (a) then a := TipDek('realni', tip, realni, prealni); if not (a) then a := TipDek('slog', tip, slog, pslog); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;var elem, i: integer;begin case tip of cijeli: DuzinaTipa := 4; pcijeli, pkarakter, prealni, pslog: begin if ukdim = 0 then DuzinaTipa := 4 else begin elem := 4*ord(tip = pcijeli)+ 1 * ord(tip = pkarakter) + 8 * ord(tip = prealni) + zadnji.duzina * ord(tip = pslog); for i := 1 to ukdim do elem := elem * dimenzije[i]; DuzinaTipa := elem; end end; karakter: DuzinaTipa := 1; realni: DuzinaTipa := 8; slog: DuzinaTipa := zadnji.duzina; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and

(TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 3: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta = polje) and (TabIdent[n].nivo = nivo) and (TabIdent[n].pod3 = p1); 4: Uslov := (TabIdent[n].nivo = nivo) and (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta =parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean; idpoz: Integer);var t1: TTip; navdim,dsvedim,i: Integer; st: string;begin navdim := 0; Emit(' PUSH EAX'); Emit(' MOV EAX,0'); repeat Novi; navdim := navdim + 1; if navdim > MAXDIM then Greska(PREVDIM); Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); if znak = ',' then begin dsvedim:=1; for i:=navdim+1 to TabIdent[idpoz].ukupdim do dsvedim:=dsvedim* TabIdent[idpoz].dim[i]; Str(dsvedim, st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; Emit(' ADD EBX,EAX');

Emit(' MOV EAX,EBX'); until znak <> ','; Emit(' POP EBX'); if (navdim <> TabIdent[idpoz].ukupdim) and (not ((navdim = 1) and (TabIdent[idpoz].ukupdim = 0))) then Greska(NESLDIM); IdiDo(']'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; prealni: begin Emit(' FSTP ST(0)'); Emit(' SAL EAX,3'); t := realni; end; pslog: begin t := slog; Str(DuzinaTipa(t), st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]') else Emit(' MOV EAX,[EBX]'); end; dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure PEmit(idpoz: Integer);var i: integer;begin if TabIdent[idpoz].ukupdim = 0 then Emit(' MOV EAX,[EBX]') else Emit(' MOV EAX,EBX'); ukdim := TabIdent[idpoz].ukupdim; for i := 0 to MAXDIM do dimenzije[i] := TabIdent[idpoz].dim[i];end;

function DeklaracijaSloga(nivo: integer): integer;var ImePolja: string; oznakasloga, podslog, duzinasloga, zapukdim, i, poz: integer; tip: TTip; imaistogtipa: Boolean; zdimenzije: array[0..MAXDIM] of integer;begin zapukdim := ukdim;

Page 88: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

88 for i := 0 to MAXDIM do zdimenzije[i] := dimenzije[i]; IdiDo('{'); ukupnoslogova := ukupnoslogova + 1; oznakasloga := ukupnoslogova; duzinasloga := 0; poz := 0; while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then podslog := DeklaracijaSloga(nivo) else podslog := oznakasloga; repeat UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, podslog); if poz <> 0 then Greska(POLJEPOS); NoviIdent(ImePolja, DuzinaTipa(tip), 0, nivo, polje, tip, podslog, duzinasloga, oznakasloga); duzinasloga := duzinasloga + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (duzinasloga mod 4) <> 0 do duzinasloga := duzinasloga + 1; IdiDo(';'); end; IdiDo('}'); zadnji.duzina := duzinasloga; zadnji.pozimena := poz; zadnji.idopisasloga := OznakaSloga; DeklaracijaSloga := OznakaSloga; ukdim := zapukdim; for i := 0 to MAXDIM do dimenzije[i] := zdimenzije[i];end;

procedure ElementSloga (idpoz: integer; var t: TTip; var dod: Boolean);var poz, nivo, idsloga: integer; Imepolja, st: string;begin if t <> slog then Greska(SLOGPOLJE); nivo := TabIdent[idpoz].nivo; idsloga := TabIdent[idpoz].pod3; while znak = '.' do begin Novi; UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, idsloga); if poz = 0 then Greska(NEDEKPOLJE); Str(TabIdent[poz].pod2, st); Emit(' ADD EBX,' + st); t := TabIdent[poz].tip; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin idsloga := TabIdent[poz].pod1; zadnji.duzina := TabIdent[poz].duzina; zadnji.pozimena := poz; zadnji.idopisasloga := TabIdent[poz].pod3; end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(poz); end; end;end;

procedure CijeliNaFPStek(reg: string; osmobitni: Boolean);begin if osmobitni then Emit(' AND ' + reg + ',0FFh'); Emit(' MOV INTTOFP,' + reg); Emit(' FILD DWORD PTR INTTOFP');end;

procedure FPStekUCijeli(reg: string);begin Emit(' ADD ESP,-4'); Emit(' FISTP DWORD PTR [ESP]'); Emit(' POP ' + reg);end;

procedure CPUStekCijeliNaFPStek(osmobitni: Boolean);begin if osmobitni then Emit(' AND DWORD PTR [ESP],0FFh'); Emit(' FILD DWORD PTR [ESP]'); Emit(' ADD ESP,4');end;

procedure FPUStekNaStek;begin Emit(' ADD ESP,-8'); Emit(' FSTP QWORD PTR [ESP]');end;

procedure StekNaFPUStek;begin Emit(' FLD QWORD PTR [ESP]'); Emit(' ADD ESP,8');end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka, duzprvogsloga, duzdrugogsloga, m1: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; duzprvogsloga := 0; duzdrugogsloga := 0; if znak <> '(' then begin velsteka := 0; for parametara := 1 to TabIdent[idpoz].pod1 do begin n := NadjiIdent('', idpoz, 4, parametara); velsteka := velsteka + ( (TabIdent[n].duzina - 1) div 4 + 1) * 4; end; Str(velsteka, st); Emit(' MOV EAX,OFFSET ' + imefunkcije + '@' + st); t := pcijeli; dod := false; end else begin IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if t2 = slog then duzdrugogsloga := TabIdent[n].duzina; if (t1 in [karakter, realni]) and (t2 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); case t2 of slog: begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ);

m1 := ((duzprvogsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; case t1 of realni: ; karakter: CijeliNaFPStek('EAX', true); else CijeliNaFPStek('EAX', false); end; FPUStekNaStek; end else begin velsteka := velsteka + 4; if t1 = realni then FPStekUCijeli('EAX'); Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh'); end;end;

procedure IndirektniPoziv(var t: TTip);var m1, velsteka, duzsloga: Integer; straddr, st: string; t1: TTip;begin velsteka := 0; NovaLabela(straddr); Emit('.DATA'); st := 'L' + straddr + ' DD ?'; Emit(st); Emit('.CODE'); Emit(' MOV L' + straddr + ',EAX'); IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); case t1 of slog: begin duzsloga := DuzinaTipa(t1); m1 := ((duzsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; FPUStekNaStek; end else begin velsteka := velsteka + 4; Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')');

Page 89: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

89 Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL L' + straddr); case t of pcijeli: t := cijeli; prealni: t := realni; pkarakter: t := karakter; pslog: t := slog; else Greska(INDNOPOINT) end;end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin zadnji.duzina := TabIdent[idpoz].duzina; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; end; pslog: begin rezultat:=1; for i:=1 to TabIdent[idpoz].

ukupdim do rezultat:=rezultat* TabIdent[idpoz].dim[i]; if rezultat<>0 then zadnji.duzina := TabIdent[idpoz].

duzina div rezultat else zadnji.duzina:=4; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; PEmit(idpoz); end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(idpoz); end; if TabIdent[idpoz].ukupdim = 0 then dod := true else dod := false; while znak ='[' do begin PokazivacINiz(t, dod, idpoz); end; if znak = '(' then IndirektniPoziv(t);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer; st, fpkonst, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NEG EAX'); realni: Emit(' FCHS'); else Greska(err); end; dod := false; end; '~': begin

Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; slog: t := pslog; realni: begin t := prealni; Emit(' FSTP ST(0)'); end; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); if t = prealni then begin Emit(' FSTP ST(0)'); Emit(' FLD QWORD PTR [EBX]'); end else Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; prealni: t := realni; pslog: begin t := slog; end; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod); end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); case t of cijeli: begin Str(rezultat, st); Emit(' MOV EAX,' + st); end; realni: begin NovaLabela(fpkonst); Emit('.DATA'); st := 'L' + fpkonst + ' DQ '+realnakonstanta; Emit(st); Emit('.CODE'); Emit(' FLD L' + fpkonst); end;

end; end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end; if znak = '.' then ElementSloga(zadnji.pozimena,t,pod);end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; Novi; Faktor(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(POGRMNOZ); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '*': Emit(' FMUL '); '/': Emit(' FDIVR '); else Greska(NEDOPFP); end end else begin t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end;

Page 90: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

90 end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Clan(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(NEDOPARIT); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '+': Emit(' FADD '); '-': Emit(' FSUBR '); else Greska(NEDOPFP); end end else begin case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end;

end; end; end; t1 := t; end;end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean; duzprvogsloga, duzdrugogsloga: Integer; st: string;begin duzprvogsloga := 0; duzdrugogsloga := 0; Izraz(t1, dod1); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); if (t1 = realni) then Emit(' FSTP ST(0)'); Novi; IzrazDodjeljivanja(t2, dod); if t2 = slog then duzdrugogsloga := DuzinaTipa(t2); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); if t1 = slog then begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); Emit(' POP EDI'); Emit(' MOV ESI,EBX'); Emit(' CLD'); Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); end else Emit(' POP EBX'); if (t2 in [karakter, realni]) and (t1 in [pkarakter, pcijeli, prealni]) then Greska(DODJPOINT); if (t1 = realni) and (t2 <> realni) then CijeliNaFPStek('EAX', t2 = karakter); if (t1 <> realni) and (t2 = realni) then FPStekUCijeli('EAX'); case t1 of karakter: Emit(' MOV [EBX],AL'); realni: Emit(' FSTP QWORD PTR[EBX]'); slog: Emit(' REP MOVSB'); else Emit(' MOV [EBX],EAX'); end; t := t1; end; {:} '=', '>', '<', '#': begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Izraz(t2, dod); if (t1 = slog) or (t2 = slog) then Greska(SLOGNEPOR); if t1 <> realni then Emit(' POP EBX'); if (t1 = realni) or (t2 = realni) then begin

if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CijeliNaFPStek('EBX', t1 = karakter) else StekNaFPUStek; Emit(' FCOMPP '); Emit(' FSTSW AX'); Emit(' SAHF'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETA AL'); '<': Emit(' SETB AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end else begin if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then

Page 91: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

91 Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i, p3: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip) - 1) div 4 + 1) * 4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, p3); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta = parametar) then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; repeat

DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, p3); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4) <> 0 do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st); Emit(ImeFunkcije + '@' + st + ':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC ' + ImeFunkcije + '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;

procedure Prevedi;var globadresa, p3: Integer; ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin Emit('.486'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' FINIT'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin if (tip=slog) or (tip=pslog) then p3 := DeklaracijaSloga(0) else p3 := 0; repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, p3); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end;

IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB '+st+' DUP(0)'); Emit('INTTOFP DD 0'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin initpp; trenlabela := 0; ukupnoident := 0; aktnivo := 0; ukupnoslogova := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 92: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

92

Prilog 9: Verzija izvornog koda kompajlera br. 8, predprocesorunit predpr8;interfaceprocedure Novi;procedure InitPp;var ulaz, privulaz: text; pozicija, brojaclinija: integer; znak: char; linija: string;implementationuses postpr8;const MAXCHAR = 200000; MAXDEFINICIJE = 50;type Tdefinicije = record ime: string[20]; pocetak: integer; kraj: integer; end;var bafer: array[1..MAXCHAR] of char; definicije: array[1..MAXDEFINICIJE] of TDefinicije; bafertop: integer; deftop: integer; glavnadat: Boolean; ObradaLinije: Boolean;

procedure InitPp;begin bafertop := 0; deftop := 0; glavnadat := true; ObradaLinije := true;end;

procedure PpDefin;var duz, i, n: integer; radi: Boolean; imes: string;

begin duz := Length(linija); if deftop < MAXDEFINICIJE then deftop := deftop + 1; n := 12; imes := ''; radi := true; while (n <= duz) and radi do begin if linija[n] in ['a'..'z', 'A'..'Z'] then imes := imes + linija[n] else radi := false; n := n + 1; end; if imes <> '' then begin definicije[deftop].ime := imes; definicije[deftop].pocetak := bafertop; radi := true; while radi do begin radi := false; if Length(linija) > 0 then if linija[Length(linija)] = '\' then begin radi := true; linija := copy(linija, 1, Length(linija) - 1); end; for i := n to Length(linija) do begin if bafertop < MAXCHAR then bafertop := bafertop + 1; bafer[bafertop] := linija[i]; n := 1; end; if radi then begin

if glavnadat then ReadLn(ulaz, linija) else ReadLn(privulaz, linija); end; end; definicije[deftop].kraj := bafertop; end; linija := '';end;

procedure PpPostoji;var imes: string; postoji: Boolean; i: integer;begin imes := copy(linija, 10, Length(linija) - 9); postoji := false; for i := 1 to deftop do if definicije[i].ime = imes then postoji := true; if not (postoji) then Obradalinije := false else ObradaLinije := true; linija := '';end;

procedure PpNePostoji;var imes: string; postoji: Boolean; i: integer;begin imes := copy(linija, 12, Length(linija) - 11); postoji := false; for i := 1 to deftop do if definicije[i].ime = imes then postoji := true; if postoji then Obradalinije := false else ObradaLinije := true; linija := '';end;

procedure Predprocesiraj;var i, n, j, duz: integer; imes, glava, rep: string; mijenjano: Boolean;begin if linija = '#dalje' then begin obradalinije := true; linija := ''; end; if not (obradalinije) then linija := ''; duz := Length(linija); if duz > 11 then if copy(linija, 1, 11) = '#definiraj ' then PpDefin; if duz > 9 then if copy(linija, 1, 9) = '#postoji ' then PpPostoji; if duz > 11 then if copy(linija, 1, 11) = '#nepostoji ' then PpNePostoji;

if duz > 7 then if (copy(linija, 1, 7) = '#dodaj ') and glavnadat then begin imes := copy(linija, 8,

Length(linija) - 7); Assign(privulaz, imes); Reset(privulaz); glavnadat := false; linija := ''; end; repeat mijenjano:=false; for i := 1 to deftop do repeat n := Pos(definicije[i].ime, linija); if (n +Length(definicije[i].ime)) <= Length(linija) then if linija[n +Length( definicije[i].ime)] in ['a'..'z', 'A'..'Z'] then n := 0; if n > 1 then if linija[n - 1] in ['a'..'z', 'A'..'Z'] then n := 0; if n > 0 then begin glava := copy(linija,1,n-1); rep := copy(linija, n + Length(definicije[i].ime), Length(linija)); linija := glava; for j := definicije[i].pocetak + 1 to definicije[i].kraj do linija := linija + bafer[j]; linija := linija + rep; mijenjano:=true; end; until n <= 0; until not(mijenjano)end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if glavnadat and not (Eof(ulaz)) then begin ReadLn(ulaz, linija); Predprocesiraj; end else begin if not (glavnadat) and not (Eof(privulaz)) then begin ReadLn(privulaz, linija); Predprocesiraj; end else begin if not (glavnadat) then begin glavnadat := true; Close(privulaz); end; end; end; Emit(';' + copy(linija, 1, 250)); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz);end;

end.

Page 93: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

93Prilog 10: Verzija izvornog koda kompajlera br. 8, postprocesor-optimizatorunit postpr8;interfaceprocedure Emit(st: string);var izlaz: text;

implementationconst dubina = 15; da = true; ne = false;

var bafer: array[1..dubina] of string; vrhbafera: integer; briseeax, koristieax, briseebx, koristiebx, koristifpu: Boolean; dubinasteka: integer;

function StrToInt(st: string): integer;var i, s, rez: integer;begin rez := 0; if st[1] = '-' then s := 2 else s := 1; for i := s to Length(st) do rez := 10 * rez + (ord(st[i]) - ord('0')); if st[1] = '-' then rez := -rez; StrToInt := rez;end;

procedure KarakterSl(var char1: string; var radi: Boolean; tekst: string; var pt: integer);var radi2: Boolean;begin char1 := ''; radi2 := true; if pt > Length(tekst) then radi := false else while radi2 do begin char1 := char1 + tekst[pt]; pt := pt + 1; if pt > Length(tekst) then radi2 := false else begin if tekst[pt] = ',' then radi2 := false end; end;end;

procedure BrojSl(var char1: string; var radi: Boolean; tekst: string; var pt: Integer);var radi2: Boolean;begin char1 := ''; radi2 := true; if pt > Length(tekst) then radi := false else begin if (tekst[pt] < '0') or (tekst[pt] > '9') then radi := false; while radi2 do begin char1 := char1 + tekst[pt]; pt := pt + 1; if pt > Length(tekst) then radi2 := false else begin if (tekst[pt] < '0') or (tekst[pt] > '9') then radi2 := false end; end; endend;

function Uzorak(uporedba, tekst: string; var char1, char2: string): Boolean;var pu, pt: integer;

radi: Boolean;begin pt := 1; pu := 1; char1 := ''; char2 := ''; radi := true; if Length(tekst) = 0 then radi := false; if uporedba = tekst then Uzorak := true else begin while (pu <= Length(uporedba)) and radi do begin if uporedba[pu] = '$' then begin pu := pu + 1; case uporedba[pu] of 'C': begin pu := pu + 1; case uporedba[pu] of '1': begin KarakterSl(char1, radi, tekst, pt); end; '2': begin KarakterSl(char2, radi, tekst, pt); end; end; end; 'N': begin pu := pu + 1; case uporedba[pu] of '1': begin BrojSl(char1, radi, tekst, pt); end; '2': begin BrojSl(char2, radi, tekst, pt); end; end; end; end end else begin if uporedba[pu] <> tekst[pt] then radi := false; pt := pt + 1; end; pu := pu + 1; end; Uzorak := radi; end;end;

procedure Status(breax, koreax, brebx, korebx: Boolean; dubst: integer; korfpu: Boolean);begin briseeax := breax; koristieax := koreax; briseebx := brebx; koristiebx := korebx; koristifpu := korfpu; dubinasteka := dubinasteka + dubst;end;

procedure LeaMovSt(var c1, c2: string; var koreax, korebx, breax, brebx: Boolean);begin if (c1 = 'EAX') or (c1 = 'AL') then breax := true; if (c1 = 'EBX') or (c1 = 'BL') then brebx := true; if ((Pos('EAX', c1) > 0) and (c1 <> 'EAX')) or (Pos('EAX', c2) > 0) or (c2 = 'AL') then koreax := true; if ((Pos('EBX', c1) > 0) and (c1 <> 'EBX')) or (Pos('EBX', c2) > 0) or (Pos('BL', c2) > 0) then korebx := true;end;

procedure PopSt(var c1, c2: string; var incsp: integer; var breax, brebx: Boolean);

begin if (c1 = 'EAX') then breax := true; if (c1 = 'EBX') then brebx := true; incsp := 4;end;

procedure PushSt(var c1, c2: string; var incsp: integer; var koreax, korebx: Boolean);begin if Pos('EAX', c1) > 0 then koreax := true; if Pos('EBX', c1) > 0 then korebx := true; incsp := -4;end;

procedure AddSubst(var c1, c2: string; var incsp: integer; var koreax,korebx: Boolean; sub: Boolean);begin if c1 = 'ESP' then incsp := StrToInt(c2); if sub then incsp := -incsp; if (Pos('EAX', c1) > 0) or (Pos('EAX', c2) > 0) or (c1 = 'AL') or (c2 = 'AL') then koreax := true; if (Pos('EBX', c1) > 0) or (Pos('EBX', c2) > 0) or (c1 = 'BL') or (c2 = 'BL') then korebx := true;end;

procedure LogicalSt(var c1, c2: string; var koreax, korebx: Boolean);begin if (Pos('EAX', c1) > 0) or (Pos('EAX', c2) > 0) or (c1 = 'AL') or (c2 = 'AL') then koreax := true; if (Pos('EBX', c1) > 0) or (Pos('EBX', c2) > 0) or (c1 = 'BL') or (c2 = 'BL') then korebx := true;end;

procedure SkokSt(var breax, brebx, korfp: Boolean);begin breax := true; brebx := true; korfp := true;end;

procedure DivMulSt(var koreax, korebx: Boolean; var c1: string);begin koreax := true; if (Pos('EBX', c1) > 0) then korebx := true;end;

procedure ObradiStanje(tr: string);var c1, c2: string; breax, koreax, brebx, korebx, korfp: Boolean; incsp: integer; prvoslovo, drugoslovo: char;begin breax := false; koreax := false; brebx := false; korebx := false; incsp := 0; korfp := true; if Length(tr) > 3 then begin prvoslovo := tr[2]; drugoslovo := tr[3]; end else begin prvoslovo := ' '; drugoslovo := ' '; end;

if prvoslovo < 'K' then

Page 94: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

94 case prvoslovo of 'A': begin if Uzorak(' ADD $C1,$C2', tr, c1, c2) then AddSubst(c1, c2, incsp, koreax, korebx, false) else if Uzorak(' AND $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'C': begin if Uzorak(' CALL $C1', tr, c1, c2) then SkokSt(breax, brebx, korfp) else if Uzorak(' CDQ', tr, c1, c2) then koreax := true else if Uzorak(' CLD', tr, c1, c2) then c1 := c1 else if Uzorak(' CMP $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'F': begin case drugoslovo of 'A': begin if Uzorak(' FADD ', tr, c1, c2) then korfp := true end; 'C': begin if Uzorak(' FCHS', tr, c1, c2) then korfp := true else if Uzorak(' FCOMPP ', tr, c1, c2) then korfp := true end; 'D': begin if Uzorak(' FDIVR ', tr, c1, c2) then korfp := true end; 'I': begin if Uzorak(' FILD $C1', tr, c1, c2) then korfp := true else if Uzorak(' FINIT', tr, c1, c2) then korfp := true else if Uzorak(' FISTP $C1', tr, c1, c2) then korfp := true end; 'L': begin if Uzorak(' FLD $C1', tr, c1, c2) then korfp := true end; 'M': begin if Uzorak(' FMUL ', tr, c1, c2) then korfp := true end; 'S': begin if Uzorak(' FSTP $C1', tr, c1, c2) then korfp := true else if Uzorak(' FSTSW AX',tr, c1, c2) then korfp := true else if Uzorak(' FSUBR ', tr, c1, c2) then korfp := true end end end; 'I': begin if Uzorak(' IDIV $C1', tr, c1, c2) then DivMulSt(koreax, korebx, c1) else if Uzorak(' IMUL $C1', tr, c1, c2) then

DivMulSt(koreax, korebx, c1) end; 'J': begin if Uzorak(' JMP $C1', tr, c1, c2) then SkokSt(breax, brebx, korfp) else if Uzorak(' JNE $C1', tr, c1, c2) then SkokSt(breax, brebx, korfp) end; end; if prvoslovo >= 'K' then case prvoslovo of

'L': begin if Uzorak(' LEA $C1,$C2', tr, c1, c2) then LeaMovSt(c1, c2, koreax, korebx, breax, brebx) end; 'M': begin if Uzorak(' MOV $C1,$C2', tr, c1, c2) then LeaMovSt(c1, c2, koreax, korebx, breax, brebx) else if Uzorak(' MUL $C1', tr, c1, c2) then DivMulSt(koreax, korebx, c1) end; 'N': begin if Uzorak(' NEG $C1', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) else if Uzorak(' NOT $C1', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'O': begin if Uzorak(' OR $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'P': begin if Uzorak(' POP $C1', tr, c1, c2) then PopSt(c1, c2, incsp, breax, brebx) else if Uzorak(' PUSH $C1', tr, c1, c2) then PushSt(c1, c2, incsp, koreax, korebx) end; 'R': begin if Uzorak(' REP MOVSB', tr, c1, c2) then c1 := c1 else if Uzorak(' RET $N1', tr, c1, c2) then incsp := StrToInt(c1) + 4 end; 'S': begin case drugoslovo of 'A': begin if Uzorak(' SAHF', tr, c1, c2) then koreax := true else if Uzorak(' SAL EAX,$N1', tr, c1, c2) then koreax := true end; 'E': begin if Uzorak(' SETA AL', tr, c1, c2) then breax := true else if Uzorak(' SETB AL', tr, c1, c2) then breax := true else if Uzorak(' SETE AL', tr, c1, c2) then breax := true else if Uzorak(' SETG AL', tr, c1, c2) then breax := true else if Uzorak(' SETL AL', tr, c1, c2) then breax := true

else if Uzorak(' SETNE AL',tr, c1, c2) then breax := true end; 'U': begin if Uzorak(' SUB $C1,$C2', tr, c1, c2) then AddSubst(c1, c2, incsp, koreax, korebx, true) end end end; 'X': begin if Uzorak(' XOR $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; end; Status(breax, koreax, brebx, korebx, incsp, korfp);end;

procedure Dump(what: string; j, i: integer);var k: integer;begin WriteLn(what); for k := j to i do WriteLn(k, bafer[k]); ReadLn;end;

procedure Obrisi(n: integer);var i: integer;begin for i := n + 1 to dubina do bafer[i - 1] := bafer[i]; vrhbafera := vrhbafera - 1;end;

procedure PushEaxOptim(pusheax: Boolean; var j: integer);var i: integer; izlaz, mebx, meax: Boolean;

begin dubinasteka := 0; Status(ne, ne, ne, ne, 0, ne); izlaz := false; meax := false; mebx := false; i := j; repeat i := i + 1; if i >= vrhbafera then izlaz := true; if (dubinasteka = 0) and not (izlaz) then begin if (bafer[i] = ' POP EAX') and not (meax) then begin//dump('Nepotrebno PUSH/POP EAX',j,i); Obrisi(i); if pusheax then Obrisi(j) else bafer[j] := ' MOV EAX,EBX'; izlaz := true; end; if (bafer[i] = ' POP EBX') and not (mebx) then begin//dump('Nepotrebno PUSH /POP EBX',j,i); Obrisi(i); if pusheax then bafer[j] := ' MOV EBX,EAX' else Obrisi(j); izlaz := true; end; end; if not (izlaz) then ObradiStanje(bafer[i]); if briseeax and not (meax) then meax := true; if briseebx and not (mebx) then mebx := true; until izlaz;end;

Page 95: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

95

procedure LeaEbxOptim(var j: integer; adresa: string);var i, k, n: integer; c1, c2, p: string; izlaz: Boolean;

begin dubinasteka := 0; Status(ne, ne, ne, ne, 0, ne); izlaz := false; i := j; if i + 1 < vrhbafera then if Uzorak(' PUSH EBX', bafer[i + 1], c1, c2) then begin ObradiStanje(bafer[i + 1]); i := i + 2; repeat if i >= vrhbafera then izlaz := true; if not (izlaz) then ObradiStanje(bafer[i]); if (dubinasteka = 0) and not (izlaz) then if Uzorak(' POP EBX', bafer[i], c1, c2) then begin//dump('Nepotrebno LEA/PUSH/POP',j,i); bafer[i] := ' LEA EBX,' + adresa; Obrisi(j + 1); Obrisi(j); izlaz := true; end; i := i + 1; until izlaz; end else begin i := i + 1; repeat if i >= vrhbafera then izlaz := true; if not (izlaz) then ObradiStanje(bafer[i]); if (koristiebx) and not (izlaz) then begin if Pos('[EBX]', bafer[i]) < 1 then izlaz := true; end; if (briseebx) and not (izlaz) then begin// dump('Nasao nepotrebno LEA',j,i); for k := j + 1 to i - 1 do begin n := Pos('[EBX]', bafer[k]); if n >= 1 then begin if Pos('EAX', bafer[k]) > 0 then p := 'DWORD PTR ' else p := ''; bafer[k] := copy(bafer[k], 1, n - 1) + p + adresa + copy(bafer[k], n + 5, Length(bafer[k]) - n - 4); end; end; Obrisi(j); izlaz := true; end; i := i + 1; until izlaz; end;

end;

procedure MovViskaOptim(var j: integer; c1: string);var i: integer; izlaz, zaeax, zaebx: Boolean;

begin Status(ne, ne, ne, ne, 0, ne); izlaz := false; zaeax := false; zaebx := false; if (c1 = 'EAX') or (c1 = 'AL') then zaeax := true else if c1 = 'EBX' then

zaebx := true else izlaz := true;

i := j; repeat i := i + 1; if i >= vrhbafera then izlaz := true; if not (izlaz) then begin ObradiStanje(bafer[i]); if zaeax then begin if koristieax then izlaz := true; if briseeax then begin//dump(' Nepotrebno MOV EAX ',j,i); Obrisi(j); izlaz := true; end; end; if zaebx then begin if koristiebx then izlaz := true; if briseebx then begin//dump(' Nepotrebno MOV EBX ',j,i); Obrisi(j); izlaz := true; end; end;

end until izlaz;end;

procedure FldOptim(var j: integer);var i: integer; izlaz: Boolean;begin Status(ne, ne, ne, ne, 0, ne); izlaz := false; i := j; repeat i := i + 1; if i >= vrhbafera then izlaz := true; if not (izlaz) then begin ObradiStanje(bafer[i]); if koristifpu then izlaz := true; if bafer[i] = ' FSTP ST(0)' then begin//dump(' Nepotrebno FLD/FSTP ',j,i); Obrisi(i); Obrisi(j); izlaz := true; end; if (i < vrhbafera - 1) and not (izlaz) then if (bafer[i] = ' ADD ESP,-8') and (bafer[i + 1] = ' FSTP QWORD PTR [ESP]')then begin i := i + 2; dubinasteka := 0; while (i < vrhbafera - 1) and not (izlaz) do begin ObradiStanje(bafer[i]); if (bafer[i] = ' FLD QWORD PTR [ESP]') and (bafer[i + 1] = ' ADD ESP,8') and (dubinasteka = 0) then begin// dump('Nepotr. FP na ESP stek',j,i+1); bafer[i + 1] := bafer[j]; Obrisi(i); Obrisi(j + 2); Obrisi(j + 1); Obrisi(j); izlaz := true; end; i := i + 1; end;

end; end until izlaz;end;

procedure Jednostruke(var j: integer);begin

if (bafer[j] = ' MOV EAX,EAX') or (bafer[j] = ' MOV EBX,EBX') or (bafer[j] = ' ADD EAX,0') or (bafer[j] = ' ADD EBX,0') then begin// dump('Nepotrebna instrukcija',j,j); Obrisi(j); endend;

procedure Parovi(var j: integer);var c1, c2, c3, c4, nep, st: string;begin nep := 'Nepotreban par'; if bafer[j][1] = 'M' then begin if Uzorak(' MOV $C1,$C2', bafer[j], c1, c2) and Uzorak(' MOV $C1,$C2', bafer[j + 1], c3, c4) then begin if ((c1 = c4) and (c2 = c3)) or ((c1 = c3) and (c2 = c4)) then begin// dump(nep,j,j+1); Obrisi(j + 1); end; end else if Uzorak(' MOV $C1,$N2', bafer[j], c1, c2) and Uzorak(' ADD $C1,$N2', bafer[j + 1], c3, c4) then begin if c1 = c3 then begin// dump(nep,j,j+1); Str(StrToInt(c2) + StrToInt(c4), st); bafer[j] := ' MOV ' + c1 + ',' + st; Obrisi(j + 1); end; end else if Uzorak(' MOV $C1,$N2', bafer[j], c1, c2) and (bafer[j + 1] = ' NEG AX') then begin// dump(nep,j,j+1); bafer[j] := ' MOV ' + c1 + '-' + c2; Obrisi(j + 1); end; end else if Uzorak(' ADD $C1,$N2', bafer[j], c1, c2) and Uzorak(' ADD $C1,$N2', bafer[j + 1], c3, c4) then begin if c1 = c3 then begin// dump(nep,j,j+1); Str(StrToInt(c2) + StrToInt(c4), st); bafer[j] := ' ADD ' + c1 + ',' + st; Obrisi(j + 1); end; end;

end;

procedure Trojke(var j: integer);var c1, c2, c3, c4, c5, c6, nep: string;begin nep := 'Nepotrebna trojka'; if Uzorak(' MOV $C1,$C2', bafer[j], c1, c2) and Uzorak(' MOV $C1,$C2', bafer[j + 2], c5, c6)// Izvrnuto zbog brzine and ( (Uzorak(' ADD $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' AND $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' SUB $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' XOR $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' MOV $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' OR $C1,$C2', bafer[j + 1], c3, c4))) then begin if (c1 = c4) and (c1 = c5) then begin// dump(nep,j,j+2); if copy(bafer[j + 1], 2, 2) <> 'OR' then bafer[j + 1] := copy(bafer[j +

Page 96: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

96 1], 1, 5) + c3 + ',' + c2 else bafer[j + 1] := copy(bafer[j + 1], 1, 4) + c3 + ',' + c2; Obrisi(j); end; end;end;

procedure Cetvorke(var j: integer);var c1, c2, c3, c4, c5, c6, c7, c8, nep: string;beginnep := 'Nepotrebna cetvorka'; if Uzorak(' PUSH $C1', bafer[j], c1, c2) and Uzorak(' POP $C1', bafer[j + 3], c7, c8) // Izvrnuto zbogbrzine and Uzorak(' MOV $C1,$C2', bafer[j + 1], c3, c4) and Uzorak(' MOV $C1,$C2', bafer[j + 2], c5, c6) and (c1 = c5) and (c3 = c6) and (c6 = c7) then begin// dump(nep,j,j+4); if (Pos('DWORD', c4) < 1) and (c4 <> 'EAX') and (c4 <> 'EBX') and (c4 <> 'ECX') then c4 := 'DWORD PTR ' + c4; bafer[j] := ' MOV ' + c3 + ',' + c1; bafer[j + 1] := ' MOV ' + c1 + ',' + c4; Obrisi(j + 3); Obrisi(j + 2); end;end;

procedure Optimizuj;var c1, c2: string; j: integer;begin

j := 1; while j <= vrhbafera - 1 do begin if (Length(bafer[j]) > 3) and (bafer[j][1] = ' ') then begin if Uzorak(' PUSH EAX', bafer[j], c1, c2) then PushEaxOptim(true, j); if Uzorak(' PUSH EBX', bafer[j], c1, c2) then PushEaxOptim(false, j); if Uzorak(' MOV $C1,$C2', bafer[j], c1, c2) then MovViskaOptim(j, c1); if Uzorak(' LEA EBX,$C1', bafer[j], c1, c2) then LeaEbxOptim(j, c1); if Uzorak(' FLD $C1', bafer[j], c1, c2) then FldOptim(j); if j < vrhbafera - 3 then Cetvorke(j); if j < vrhbafera - 2 then Trojke(j); if j < vrhbafera - 1 then Parovi(j);

Jednostruke(j); end; j := j + 1; end;end;

procedure Emit(st: string);var i: integer;begin if st = '.486' then begin vrhbafera := 0; dubinasteka := 0; end; vrhbafera := vrhbafera + 1; if vrhbafera >= dubina then Optimizuj; if vrhbafera > dubina then begin WriteLn(izlaz, bafer[1]); Obrisi(1); vrhbafera := dubina;

end; bafer[vrhbafera] := st; if Length(st) >= 3 then if copy(st, 1, 3) = 'END' then begin Optimizuj; for i := 1 to vrhbafera do WriteLn(izlaz, bafer[i]); end

end;

end.

Page 97: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

97Prilog 11: Prikaz finalne verzije jezika FILDZAN-32 u EBNFProgram = { (DeklaracijaVarijabli | DeklaracijaFunk cije) } "{" ( {DeklaracijaVarijabli} Blok | "}" ) .DeklaracijaVarijabli = ImeTipa Identifikator { "," Identifikator } ";" { ImeTipa Identifikator { "," Identifikator } "; "} .ImeTipa = ( "cijeli" ["*"] [DeklaracioniDimenzijski Modifikator] | "realni" ["*"] [DeklaracioniDimenzijskiModifikato r] | "karakter" ["*"] [DeklaracioniDimenzijskiModifika tor] | "slog" ["*"] DeklaracijaSloga [DeklaracioniDimenz ijskiModifikator] ) .DeklaracijaFunkcije = ImeTipa "funkcija" Identifika tor "(" [ ImeTipa Identifikator { "," ImeTipa Identif ikator } ] ")" ( ";" | "{" [DeklaracijaVarijabli] Blok ) .DeklaracioniDimenzijskiModifikator = "[" NumerickaK onstanta { "," NumerickaKonstanta } "]" .DeklaracijaSloga = "{" ImeTipa Identifikator { "," Identifikator } ";" { ImeTipa Identifikator { "," Identifikator } "; " } "}" .Blok = { ( "dok" Petlja | "ako" Uslov | IzrazDodjeljivanja ";" | "asembler" AsemblerskiModul) } "}" .Uslov = IzrazDodjeljivanja "{" Blok [ "inace" "{" B lok ] .Petlja = IzrazDodjeljivanja "{" Blok .AsemblerskiModul = {BiloKojiZnak} "\" .IzrazDodjeljivanja = Izraz [ ( ("="| "#" | ">" | "< " ) Izraz | ":=" IzrazDodjeljivanja ) ] .Izraz = Clan { ("-" | "+" | "&" | "|" | "^") Clan } .Clan = Faktor { ("*" | "/" | "%") Faktor } .Faktor = ( ("-" | "~" | "&" | "*" | "!") Faktor | N umerickaKonstanta | "(" IzrazDodjeljivanja ")" | Varijabla | '"' St ringKonstanta | PozivFunkcije | "'" BiloKojiZnakOsimNavodnika "'" ) [( "." Identifikator | ListaIndeksa ) { ( "." Ide ntifikator | ListaIndeksa ) } ) ] .Varijabla = Identifikator [ ( "(" [ IzrazDodjeljivanja { "," IzrazDodjeljiv anja } ] ")" .StringKonstanta = { BiloKojiZnakOsimNavodnika } '"' .ListaIndeksa = "[" IzrazDodjeljivanja { "," IzrazDo djeljivanja } "]" .PozivFunkcije = Identifikator "(" [ IzrazDodjeljiva nja { "," IzrazDodjeljivanja } ]")" .NumerickaKonstanta = Cifra { Cifra } [ "." Cifra { Cifra } ] [ "E" [ ( "+" | "-" )] Cifra { Cifra } ] .Identifikator = Slovo { Slovo | Cifra | "_" } .Slovo = ("A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ) .Cifra = ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ) .BiloKojiZnakOsimNavodnika = (Slovo | Cifra | "~" | "!" | "@" | "#" | "$" | "%" | "^" | "&" | "*" | "(" | ")" | "-" | "_" | "=" | "+" | "[" | "{" | "]" | "}" | "|" | "\" | ":" | ";" | "<" | "," | "." | ">" | "/" | "?" | "`" | ")" ) .BiloKojiZnak = (BiloKojiZnakOsimNavodnika | '"' | " '" ) .

Page 98: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

98

13. TEORIJA JEZIKA I PARSIRANJA

Kompajler razvijen u prethodnim poglavljima razvijen je spiralnom metodom, pri čemu je veća pažnja posvećivanagenerisanju koda nego sintaksnoj i semantičkoj analizi. U složenijim kompajlerima sintaksna analiza može biti veomazahtjevna, i ova slika o razvoju kompajlera neće biti kompletna bez uvoda u teoriju formalnih gramatika i parsiranja.

13.1. Formalne gramatike

Formalna gramatika je način opisa formalnog jezika, tj. skupa nizova simbola sastavljenih iz određenog konačnogalfabeta. Ime je dobila formalna gramatika zbog analogije sa konceptom gramatike u ljudskim jezicima.

Osnovna ideja iza ovih gramatika je da se generišu nizovi znakova koji počinju specijalnim startnim simbolom iprimjene pravila koja određuju kako se određena kombinacija simbola može zamijeniti drugom kombinacijom simbola. Naprimjer, ako se alfabet sastoji od znakova 'a' i 'b', a startni simbol je 'S', uz sljedeća pravila:

1. S -> aSb2. S -> batada se može napisati "S" kao "aSb" zamjenom simbola 'S' sa "aSb" (pravilo 1), a zatim prepisati "aSb" kao "aaSbb"

primjenom istog pravila. To se ponavlja sve dok rezultat ne sadrži samo simbole iz alfabeta. U našem primjeru može se daljeprepisati S kao što slijedi: S -> aSb -> aaSbb -> aababb. Jezik ove gramatike se onda sastoji od svih stringova koji se mogugenerisati na ovaj način: ba, abab, aababb, aaababbb, itd.

13.2. Kontekstno osjetljiva gramatika

Kontekstno osjetljiva gramatika je formalna gramatika G = (N, T, P, S) čija su sva pravila P oblika

αAβ -> αγβ

gdje A neterminalni simbol, α i β su nizovi neterminalnih i terminalnih simbola, a γ neprazan niz neterminalnih iterminalnih simbola , uz dodatno pravilo koje je dopušteno ako se S ne nalazi sa desne strane nijednog pravila:

S -> ε

Gdje je ε prazan niz

Pojam “Kontekstno osjetljiva” potiče od činjenice da α i β definišu kontekst u kome se A može transformisati sa γ iline. To je različito od kontekstno slobodnih gramatika gdje se kontekst neterminalnih simbola ne uzima u razmatranje.Formalni jezik opisan kontekstno osjetljivom gramatikom se naziva kontekstno osjetljiv jezik.

U prirodnim jezicima je čest slučaj da riječ nije odgovarajuća na određenom mjestu u datom kontekstu.

13.3. Nesažimajuća gramatika

Druga definicija kontekstno osjetljive gramatike definiše je kao formalnu gramatiku koja ima ograničenje na pravilaα -> β u skupu P tako da je | α | ? | β | gdje je | α | dužina simbola α. Takva gramatika se zove nesažimajuća gramatika jernijedno od pravila ne smanjuje veličinu niza simbola koji se razvija.

Iako različite, kontekstno osjetljiva i nesažimajuća gramatika su ekvivalentne jer definišu istu klasu jezika osim štonesažimajuća gramatika ne može generisati jezik koji sadrži simbol praznog prostora. Ali, ako se jezik L može opisatikontekstno osjetljivom gramatikom, on se (izuzev praznog simbola) može predstaviti i nesažimajućom gramatikom.

13.4. Kontekstno slobodna gramatika

Kontekstno slobodna gramatika je formalna gramatika čija su sva pravila oblika:

V -> w

Gdje je V neterminalni simbol, a w niz koji se sastoji od terminalnih i/ili neterminalnih. Pojam kontekstno slobodnaznači da se varijabla V uvijek može zamijeniti sa w, bez obzira u kojem je kontekstu. Formalni jezik je kontekstno slobodanako postoji kontekstno slobodna gramatika koja ga generiše.

Kontekstno slobodnom gramatikom se definišu gotovo svi programski jezici i na bazi nje se prave parseri/sintaksnianalizatori.

13.5. Regularna gramatika

Regularna gramatika je formalna gramatika u kojoj sva pravila imaju jedan od sljedećih oblika:

A -> a gdje je A neterminalni simbol dok je a terminalni simbol

Page 99: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

99A -> aB gdje su A i B neterminalni simbol dok je a terminalni simbol

A -> ε gdje je A neterminalni simbol

Alternativno, drugo pravilo se može pisati kao A -> Ba.

Primjer: Gramatika G sa N = {S, A}, Σ = {a, b, c}, P pravila su

S -> aS

S -> bA

A -> ε

A -> cA

i S kao startni simbol. Ova gramatika opisuje isti jezik kao regularni izraz a*bc*.

Regularna gramatika opisuje konačne automate i regularne jezike. Koristi se u leksičkoj analizi.

13.6. Parsiranje

Prevođenje iz jednog jezika u drugi zahtjeva parsiranje. Parsiranje je proces identifikacije strukture podataka. Onoodređuje da li ulazni podaci imaju određenu strukturu. Da bi se obavilo parsiranje potrebna je gramatika, koja će definisatiskup pravila. Pravila su određeni uzorci podataka koja dalje mogu da imaju reference na druga pravila. Zavisno od skupapravila mogu se definisati parseri odozgo prema dolje ili odozdo prema gore.

13.7. LL Parsiranje

Prevodilac ne generiše rečenice u izvornom jeziku, nego ih prepoznaje. To znači da koraci koji vode do konstrukcijerečenice moraju biti izvedeni iz gotove rečenice. Dok je za jezike kao što je Pascal taj zadatak relativno jednostavan, dosta jesložen za jezike poput Fortrana ili C++a.

Razvijajući programski jezik FILDZAN32 bez posebnog navođenja korišten je način parsiranja odozgo nadolje,takozvani rekurzivni silazak. Gramatike jezika Pascal i Modula 2 se definišu tako da se može primijeniti ovaj način parsiranja.

Suština metoda je da se kreće od startnog simbola (npr. “program”) i pokušava dobiti rečenica primjenom sekvencepravila. To se čini gledajući sljedeći terminalni simbol na ulazu.

Kao ilustracija ove metode neka posluži sljedeća jednostavna gramatika: G = { N , T , S , P } N = { A , B } T = { x , y , z } S = A P = A : xB (1) B : z (2) B : yB (3)

Ako treba parsirati rečenicu xyyz, koja je sastavljena od terminalnih simbola ove gramatike, kreće se od ciljnog simbola iulaznog niza

Rečenička forma S = A Ulazni niz xyyz

Nad rečeničkom formom 1 se primjeni jedino moguće pravilo (1) da se dobije

Rečenička forma xB Ulazni niz xyyz

Za sada je u redu, jer se slažu početni simboli rečeničke forme i ulaznog niza. Stoga treba iz neterminalnog simbola B izvestiyyz.

Rečenička forma B Ulazni niz yyz

Može se odabrati bilo pravilo (2) ili (3) u obradi neterminalnog simbola B, ali se iz ulaznog stringa vidi da je (3) pravi izbor.Primjenom tog pravila dobija se:

Rečenička forma yB Ulazni niz yyz

Što znači da se iz neterminalnog simbola B mora izvesti yz.

Rečenička forma B Ulazni niz yz

To nas ponovo vodi do pravila (3) i dobijamo

Page 100: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

100 Rečenička forma yB Ulazni niz yz

što povlači da se iz neterminalnog simbola B mora izvesti terminalni simbol z direktno, što se postiže pravilom (2).

Primjer rečenica koje se ne mogu prepoznati ovom gramatikom su xxxx ili xyyyy.

Ova metoda se zove LL(k) parsiranje. Naziv potiče od toga što se ulazni string skenira s lijeva na desno (prvo L)primjenjujući pravila na prvi lijevi neterminalni simbol (drugo L) gledajući maksimalno k terminalnih simbola da se odredikoje pravilo primijeniti u datom stanju. U našem primjeru, k=1, te LL(1) je najčešći slučaj LL(k) parsiranja.

Lako je napisati LL(1) parser, ali pisanje gramatike u takvom obliku zna biti složen posao, pogotovo što se ne možesvaka gramatika transformisati u ovaj oblik. Evo primjera kako se mogu vršiti potrebne transformacije da bi se dobila LL(1)kompatibilna gramatika:

Neka je u nekoj gramatici REPEAT petlja predstavljena u obliku: RepeatStatement = "REPEAT" Statem entSequence "UNTIL" Condition | "REPEAT" State mentSequence "FOREVER" .

Oba oblika počinju rezervisanom riječju REPEAT, što zbunjuje parser. Ali, ako se definiše: RepeatStatement = "REPEAT" Statemen tSequence TailRepeatStatement . TailRepeatStatement = "UNTIL" Condition | "FOREVER" .

nema problema s parsiranjem. No, u sljedećem slučaju Statement = IfStatement | Ot herStatement . IfStatement = "IF" Condition "THEN" Statement | "IF" Condition "THEN" Statement "ELSE" Statement .

čak nakon rastavljanja pravila i dalje postoji neodređenost. Statement = IfStatement | Ot herStatement . (1, 2) IfStatement = "IF" Condition " THEN" Statement IfTail . (3) IfTail = "ELSE" Statement | e . (4, 5)

Ova neodređenost se obično rješava pravilom da ELSE se odnosi na zadnji THEN. U FILDZAN-32, ovaj problem je izbjegnut,uvođenjem obaveznih vitičastih zagrada u naredbi ako.

13.8. LR Parsiranje

Drugi popularni način parsiranja je LR(k) parsiranje. Ove oznake predstavljaju da se u ovoj metodi ulazni podacičitaju sa Lijeva na desno, razvijajući stalno krajnji desni (Right) simbol, gledajući unaprijed najviše k simbola. U praksi je knajčešće 1 ili 0.

Tehnika je bazirana na principu odozdo nagore. Kreće se od ulazne sekvence i praveći redukcije, teži se da se dođe dociljnog simbola. Redukcija rečenice se ne postiže zamjenom desne strane pravila čija lijeva strana sadrži odgovarajućineterminalni simbol, nego zamjenom lijeve strane pravila koje se slaže sa desnom stranom.

Parsiranje odozdo nagore može koristiti stek za parsiranje koji sadrži dio mogućih rečeničnih formi terminalnih ineterminalnih simbola. Svaki put kada se čita terminalni simbol iz ulaznog stringa, on se smješta na stek za parsiranje, zatim seispituju elementi na vrhu steka da se vidi da li se može obaviti redukcija. Neki terminalni simboli mogu dugo stojati na stekusve dok se ne oslobode. To je različito od parsera sa rekurzivnim spuštanjem koji oslobađa terminalne simbole čim ih jepročitao i koji smješta neterminalne komponente parcijalne rečenične forme samo implicitno kao niz nedovršenih pozivapotprograma za obradu neterminalnih simbola.

Evo primjera za gramatiku koja nije LL(1) tipa definisanu kao

Goal = Expression "." . (1) Expression = Expression "-" Term | Term . (2, 3) Term = "a" (4)

I treba parsirati ulazni niz "a - a - a ." .

Ovo su akcije koje će se obaviti

Step Action Using production Stac k

1 read a a 2 reduce 4 Term 3 reduce 3 Expr ession 4 read - Expr ession - 5 read a Expr ession - a 6 reduce 4 Expr ession - Term 7 reduce 2 Expr ession 8 read - Expr ession - 9 read a Expr ession - a 10 reduce 4 Expr ession - Term 11 reduce 2 Expr ession 12 read . Expr ession . 13 reduce 1 Goal

Page 101: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

101Cilj je dostignut i rečenica je ispravna

Ipak, postavlja se pitanje u ovom primjeru zašto nije korišteno pravilo Goal=Expression kada je reduciran string "a" uExpression nakon koraka 3? Da bi se primijenila redukcija, naravno da je potrebno da lijeva strana pravila bude na steku zaparsiranje, ali je samo po sebi nedovoljno. Kada postoji više mogućih desnih strana koje se slažu sa elementima na vrhu stekaza parsiranje, pravi parser treba da primjeni odgovarajuću strategiju, gledajući unaprijed ulazni string da odluči koje će praviloprimijeniti.

Ovakvi parseri se upravljaju tablicama, gdje odgovarajuća strategija u odgovarajućem trenutku biva određenagledanjem u pravougaonu matricu, čija jedna dimenzija predstavlja stanje parsiranja (tj. poziciju koju je parser dosegao unutargramatičkih pravila) , a druga predstavlja trenutni simbol (tj. terminalni ili neterminalni simbol gramatike). Elementi tabeleprihvataju ulazni string kao korektan, odbacuju kao nekorektan, prelaze u druga stanja ili vrše redukciju primjenomodgovarajućeg pravila. Umjesto smještanja na stek samih simbola kako je bilo navedeno u prethodnom primjeru, algoritam zaparsiranje smješta ili skida elemente koji predstavljaju stanje parsiranja - shift operacije koje smještaju novodosegnuto stanjena stek i reduce operacije koje skidaju onoliko elemenata sa steka koliko je simbola na desnoj strani pravila koje seprimjenjuje. Algoritam se može opisati kao:

BEGIN GetSYM(InputSymbol); (* first Sym in sentence * ) State := 1; Push(State); Parsing := TRUE; REPEAT Entry := Table[State, InputSymbol]; CASE Entry.Action OF shift: State := Entry.NextState; Push(State); IF IsTerminal(InputSymbol) THEN GetSYM(InputSymbol) (* accept *) END reduce: FOR I := 1 TO Length(Rule[Entry].RightSid e) DO Pop END; State := Top(Stack); InputSymbol := Rule[Entry].LeftSide; reject: Report(Failure); Parsing := FALSE accept: Report(Success); Parsing := FALSE END UNTIL NOT Parsing END

Algoritam je jednostavan, ali je pravljenje tabele za parsiranje dosta teško. Ovdje neće biti navedeno kako se to radi,ali za gornji primjer tabela za parsiranje može izgledati ovako (bez elemenata za odbacivanje)

Symbol

Goal Expression Term "a" "-" "." State

1 Accept Shift 2 Shift 3 Shift 4 2 Shift 5 Reduce 1 3 Reduce 3 Reduce 3 4 Reduce 4 Reduce 4 5 Shift 6 Shift 4 6 Reduce 2 Reduce 2

Parsiranje stringa "a - a - a ." će teći na sljedeći način:.

State Symbol Stack Action

1 a 1 Shift to state 4, accept a 4 - 1 4 Reduce by (4) Ter m = a 1 Term 1 Shift to state 3 3 - 1 3 Reduce by (3) Exp ression = Term 1 Expression 1 Shift to state 2 2 - 1 2 Shift to state 5, accept - 5 a 1 2 5 Shift to state 4, accept a 4 - 1 2 5 4 Reduce by (4) Ter m = a 5 Term 1 2 5 Shift to state 6 6 - 1 2 5 6 Reduce by (2) Exp ression = Expression - Term 1 Expression 1 Shift to state 2 2 - 1 2 Shift to state 5, accept - 5 a 1 2 5 Shift to state 4, accept a 4 . 1 2 5 4 Reduce by (4) Ter m = a 5 Term 1 2 5 Shift to state 6 6 . 1 2 5 6 Reduce by (2) Exp ression = Expression - Term 1 Expression 1 Shift to state 2 2 . 1 2 Reduce by (1) Goa l = Expression 1 Goal 1 Accept as complet ed

Page 102: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

102Tablice mogu biti dosta velike pa se u memoriji često smještaju pomoću metoda za rijetke matrice. Kao u slučaju

LL(1) parsera potrebno je osigurati da se izbjegnu neodređenosti između pravila koje se nazivaju "Shift/reduce" konflikti.Pravljenje tablica i provjera konflikta se ostavlja generatorima parsera.

LR(k) parsiranje je mnogo moćnije od LL(k) parsiranja, i intuitivno konstruisane gramatike zahtijevaju daleko manjetransformacija da se napravi gramatika iz koje se može generisati LR(k) parser. Na primjer, LR(k) parsiranje podržava lijevurekurziju, dok LL(k) ne podržava. Također, tablice predstavljaju brži način parsiranja od velikog broja uslova. LR parseriimaju prednost u lakšem dodavanju oporavka od grešaka. Nedostaci LR parsera u odnosu na LL parsere su u veličini tablicakoje LR parseri oni moraju imati, težem dodavanju semantike i generisanog koda i često čudnim porukama o greškama.

13.9. Generatori parsera

Pravljenje parsera je toliko standardiziran posao da postoje i programi koji ih generišu iz opisa gramatike jezika.Mogu se podijeliti na generatore leksičkih analizatora, generatore LR parsera i generatore LL parsera.

Najpoznatiji generator leksičkih analizatora je LEX, i njegova besplatna varijanta FLEX. Leksički analizatorgenerisan ovakvim programom je, na primjer, sposoban da ključnu riječ BEGIN prizna kao jedan simbol, dok riječ BEGIpredstavlja četiri simbola. Slijedi dio ulazne datoteke koja se koristi za generisanje leksičkog analizatora (skanera) kojiprepoznaje programski jezik Pascal, a koju prihvata YACC.

[a-zA-Z]([a-zA-Z0-9])* if (is_keyword(yytext, kw)) { return(kw);} else {return(IDENTIFIER); }":=" return(ASSIGNMENT);'({NQUOTE}|'')+' return(CHARACTER_STRING);":" return(COLON);"," return(COMMA);[0-9]+ return(DIGSEQ);"." return(DOT);".." return(DOTDOT);"=" return(EQUAL);">=" return(GE);">" return(GT);"[" return(LBRAC);"<=" return(LE);

LEX sarađuje sa generatorom LR parsera YACC (Yet Another Compiler Compiler) čija se besplatna varijanta zoveBison. Iz definicije gramatike kakva je data na kraju klasične knjige Kernighan-Ritchie, "Programski jezik C" može segenerisati parser, obično napisan u jeziku C, zajedno sa tabelama. Na slici je dat dio ulazne datoteke koja se koristi zagenerisanje parsera koji prepoznaje programski jezik Pascal, a koju prihvata YACC.

program : program_heading semicolon block DOT ;

program_heading : _PROGRAM identifier | _PROGRAM identifier LPAREN identifier_list RP AREN ;

identifier_list : identifier_list comma identifier | identifier ;

block : label_declaration_part constant_definition_part type_definition_part variable_declaration_part procedure_and_function_declaration_part statement_part ;

module : constant_definition_part type_definition_part variable_declaration_part procedure_and_function_declaration_part ;

Parseri LEX i YACC su izrađeni i u verzijama koje generišu izvorni kod parsera u drugim programskim jezicimapored jezika C. Tako na primjer program TPLY - TP Lex and Yacc generiše izvorni kod za Turbo Pascal.

Eikhound je generator generalizovanih LR parsera koji može prevesti svaku kontekstno slobodnu gramatiku,uključujući i one koje generišu shift/reduce konflikte.

Jedan od generatora LL(1) parsera zove se COCO/R i napravljen je u različitim verzijama za razne jezike izvornogkoda koji se generiše. Prednost ovog generatora je u vrlo preglednom ulaznom formatu (standardni BNF) i čitljivom izlaznomkodu. Ovaj generator iz iste ulazne datoteke pravi i leksičke analizatore. . Na slici je dat dio ulazne datoteke koja se koristi zagenerisanje leksičkog analizatora (skanera) koji prepoznaje programski jezik Pascal, a koju prihvata COCO/R.

Page 103: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

103

TOKENS identifier = letter { letter | digit } . integer = digit { digit } | digit { digit } CONTEXT ("..") . real = digit { digit } "." digit { digit } [ "E" ["+" | "-"] digit { digit } ] | digit { digit } "E" ["+" | "-"] digit { digit } . string = "'" { noQuote1 | "''" } "'" .

PRODUCTIONS

Pascal = "program" NewIdent [ Externa lFiles ] ";" Block "." . ExternalFiles = "(" NewIdentList ")" . Block = DeclarationPart StatementPar t . DeclarationPart = LabelDeclarations ConstDefini tions TypeDefinitions VarDeclaratio ns { ProcDeclarations } .

/* ------------------------------------------------ ---------------- */

LabelDeclarations = [ "label" Labels ";" ] . Labels = Label { "," Label } . Label = UnsignedInt .

/* ------------------------------------------------ -------------------- */

ConstDefinitions = [ "const" ConstDef { ConstDef } ] .

ConstDef = NewIdent "=" Constant ";" .

O načinu pripreme ulaznih datoteka za spomente generatore parsera potrebno je pročitati njihovu dokumentaciju.Generatori parsera se inače zovu i kompajler-kompajleri.

13.10. Rezime poglavlja

Detaljnije znanje o pravljenju kompajlera može se steći upoznavanjem teorije formalne lingvistike i parsiranja.Gramatika programskog jezika je definisana skupom neterminalnih simbola, skupom terminalnih simbola, jezičkim pravilima ipočetnim ili ciljnim simbolom. Gramatike se dijele na formalne, kontekstno neovisne, kontekstno osjetljive i regularne. Zakontekstno neovisne gramatike se prave parseri koji obavljaju sintaksnu analizu. LL parsiranje je metoda koja radi od vrha kadnu razvijajući stalno ulazni string i zavisno od sljedećeg terminalnog simbola poziva odgovarajući potprogram. LR parsiranjekoristi stek i tablice kako bi se prepoznao odgovarajući jezički pojam i ova metoda ide odozdo nagore. LR parseri pokrivajuširu klasu gramatika od LL parsera. Parseri se mogu praviti generatorima parsera kakvi su Yacc i COCO/R.

Page 104: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

104

14. OSNOVNI WIN32 API PROGRAM

Nakon što je napisan kompajler, slijedi pisanje sistemskih funkcija. Sretna je okolnost što operativni sistem Windowsveć ima ogroman broj sistemskih funkcija tako da je samo potrebno pozivati ih. Radi razumijevanja rada testnih aplikacija, kaoi razumijevanja koncepta sistemskih poziva pod operativnim sistemom Windows, slijedi nekoliko lekcija koje govore o načinukorištenja Windows sistemskih funkcija.

14.1. Hello World

Najprimitivniji FILDZAN32 Windows program izgleda kao na slici Sl. 14.1.1.

Cijeli funkcija MessageBoxA(cijeli a,karakter * b, karakter * c, cijeli d);{ MessageBoxA(0,"Zdravo", "Fildzanski pozdrav", 0 ); 0;}

Sl. 14.1.1. Primitivni Win32 program

14.2. Prosti Prozor

Programi koji prikazuju prozor na ekranu imaju standardizovani izgled kao na slici Sl. 14.2.1:cijeli funkcija RegisterClassExA(cijeli * wndclass) ;cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, ci jelic,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,c ijeli c,cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija LoadIconA ( cijeli a,cijeli b) ;cijeli funkcija DestroyWindow ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijelic,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b ,karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c );cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli hInstance;karakter * klasa;slog { cijeli cbSize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wc; ` Klasa prozora cijeli hwnd; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } Msg; ` Poruka

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijelimsg, cijeli hwnd){ cijeli obrada; obrada:=0;

ako (msg=16){ DestroyWindow(hwnd); obrada:=1;}` WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} `W M_DESTROY ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;}

}

` Glavni program{

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_AP PLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC _ARROW wc.hbrBackground := 6; `COLOR_WINDOW_FRAME wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_AP PLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registrac ija!",0); } inace {` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,120,140 , 100,200, 13565952, ` ,WS_OVERLAPPEDWINDOW "Windows aplikacija","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiran je!",0); } inace {

ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd); ` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; } }}

Sl. 14.2.1. Osnovni prozorOvo je jedan od najkraćih primjera koji generiše osnovni prozor pod Windowsom. Slijedi objašnjenje rada u četiri

koraka.

Page 105: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

10514.3. Korak 1: Registracija prozorske klase

Prozorska klasa čuva informacije o tipu prozora uključujući njegovu prozorsku proceduru koja ga kontroliše, male ivelike ikone prozora i pozadinske boje, Na ovaj način moguće je registrovati klasu jednom i kreirati prozora koliko se želi bezspecificiranja svih tih atributa svaki put, mada se oni mogu po želji mijenjati za pojedinačne prozore. Prozorske klase nemajuveze sa C++ klasama.

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_AP PLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC _ARROW wc.hbrBackground := 6; `COLOR_WINDOW_FRAME wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_AP PLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registrac ija!",0); } inace {

Ovaj se kod koristi u glavnom programu za registraciju prozorske klase. Sada će se popuniti strukturaWNDCLASSEX i poziva funkcija RegisterClassEx()

Članovi strukture utiču na klasu prozora kako slijedi:

cbSize : Veličina strukture.

style : Stil klase, CS_xxxxx, on se obično postavlja na 0..

lpfnWndProc :Pokazivač na proceduru koja obraðuje poruke za ovu klasu prozora.

cbClsExtra : Količina dodatnih podataka alociranih za ovu klasu u memoriji. Obično 0.

cbWndExtra: Količina dodatnih podataka u memoriji alociranih po prozoru. Obično 0...

hInstance : Handle koji pokazuje na instancu aplikacije (dobiven funkcijom GetModuleHandle)

hIcon : Velika (32x32) ikona koja se prikazuje prilikom AltTab.

hCursor : Kurzor koji se prikazuje preko prozora ove klase.

hbrBackground: Oznaka četke za pozadinu za postavljanje boje ovog prozora

lpszMenuName: Ime menija u resursnom dijelu datoteke za prozore ove klase

lpszClassName: Ime kojim se klasa identificira

hIconSm : Mala (16x16) ikona koja se pojavljuje u taskbaru i u gornjem lijevom uglu prozora.

U praksi se ova struktura ne pamti, nego se najčešæe kopira, niti ima potrebe pamtiti je. Neophodno je imati helpdatoteke kada se želi modifikovati neki od parametara..

Nakon što je ova struktura popunjena, poziva se RegisterClassEx i provjeravaju greške. U slučaju greške prikaže seporuka i prekida program izlaskom iz glavnog programa.

14.4. Korak 2: Kreiranje prozora

Nakon što je klasa registrovana, slijedi kreiranje prozora pomoću nje. To se radi pomoću funkcije CreateWindowEx,čiji će parametri sada biti objašnjeni..

` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,120,140 , 100,200, 13565952, ` ,WS_OVERLAPPEDWINDOW "Windows aplikacija","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiran je!",0); } inace {

Zadnji parametar, 512 je prošireni windows stil koji daje drugačiji izgled ivice. Može se eksperimentirati i sa drugimvrijednostima..

Page 106: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

106Ime klase "FILDZANKLASA" kaže sistemu kakvu vrstu prozora da kreira. U datom primjeru, treba kreirati prozor od

klase koja je upravo registrovana, pa će se njeno ime i koristiti. Nakon toga se navodi ime prozora ili naslov koji se prikazuje unaslovnom dijelu prozora..

Parametar koji u datom primjeru ima vrijednost 13565952 (WS_OVERLAPPEDWINDOW) je parametar stilaprozora. Ima više različitih stilova i korisno je eksperimentisati sa njima da se vidi šta koji radi..

Sljedeća četiri parametra (120,140,100,200) su visina prozora, širina prozora, y koordinata i x koordinata x i ykoordinate gornjeg lijevog ugla i širina i visina prozora. Jedinice su u pikselima, ishodište koordinatnog sistema je gornji lijeviugao, tako da y osa raste prema dolje, a x osa prema desno.

Sljedeća četiri parametra (0,hinstance,0,0) su pokazivač na dodatne podatke o kreiranju prozora, te hendlovi nainstancu aplikacije, meni i roditeljski prozor. Ekranska unosna polja ili dugmad predstavljaju podprozore i za njih je potrebnopostaviti vrijednost Parent. U ovom primjeru, ovo je glavni prozor i on nema roditeljskog prozora..

Čest uzrok grešaka u programima je što se ne provjerava rezultat funkcija. CreateWindow() često pada i kod iskusnihprogramera, stoga je potrebno uvijek provjeravati njen rezultat!

ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiran je!",0); }

Nakon što je prozor kreiran i provjerena ispravnost njegovog hendla, sada je potrebno prikazati i ažurirati prozor.Konstanta 10 (SW_SHOW) znači da se prozor treba prikazati.

ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd);

14.5. Korak 3: Petlja poruka

Ovo je srce cijelog programa, praktično sve što program radio prolazi kroz ovu tačku.

` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; }

GetMessage() preuzima poruku iz reda čekanja korisničke aplikacije. Svaki put kada korisnik pomjeri miša, otkucanešto na tastaturi, klikne na meni prozora ili uradi mnogo drugih stvari, poruke se generišu od strane sistema i smjeste u redčekanja korisničkog programa. Pozivom GetMessage() zahtijeva se da se sljedeća poruka izbaci iz reda čekanja i predaprogramu za procesiranje. Ako nema poruke GetMessage prelazi u čekanje do nailaska nove. Ukoliko to predstavlja problem,neki programi koriste poruku PeekMessage() koja radi isto kao GetMessage, samo što nastavlja rad ako u redu čekanja nemanovih poruka..

TranslateMessage() dodatno procesira poruke tastature kao što je generisanje poruka WM_CHAR da se šalju zajednosa WM_KEYDOWN porukom. Poruka DispatchMessage šalje poruku prozoru kome je poruka namijenjena. To može bitiglavni prozor aplikacije, ali i bilo koji drugi prozor, korisnička kontrola ili neki prozor kreiran od strane sistema ili drugeaplikacije. O tome ne treba brinuti jer se je jedini zadatak programa da preuzme i pošalje poruku, a sistem rješava kako će opnadoći do odgovarajućeg prozora..

14.6. Korak 4: Prozorska procedura

Ako je petlja poruka srce programa, prozorska procedura je njegov mozak. Na ovom mjestu se obraðuju sve porukeposlane prozoru..

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY

ako (obrada#1) { DefWindowProcA(lParam,wParam,m sg,hwnd); } inace {0;}

}

Prozorska procedura se poziva za svaku poruku. HWND parametar je hendl prozora, tj. onaj na koga se porukaodnosi. To je bitan podatak jer svi prozori iste klase dijele istu prozorsku proceduru, pa se oni meðusobno razlikuju po HWNDparametru.

Page 107: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

107WM_CLOSE se šalje kada korisnik pritisne taster Close ili Alt+F4. To će izazvati uništavanje prozora i inače, ali je

ovdje obrada izdvojena kako bi se mogao dodati eventualni kod koji posprema ostale podatke prije uništenja prozora, kao štoje upit korisnika za snimanje datoteka..

Poziv funkcije DestroyWindow() šalje poruku WM_DESTROY prozoru koji treba biti uništen, uništavajući potomsve njegove podprozore. Na prijem ove poruke poziva se funkcija PostQuitMessage. Ova funkcija šalje WM_QUIT petlji zaprozore. Ova se poruka nikada ne dobija, jer ona izaziva da GetMessage() vrati netačnu vrijednost čime se prekida obradaporuka.

14.7. Obrada poruka

Sada prozor postoji mada može da radi jedinoono što mu omogućava DefWindowProc(),proširivanja, maksimiziranja, ali nikakav drugi kod.Dodatne funkcionalnosti se mogu dodavati obradompojedinačnih poruka. Obrada poruke predstavlja širenjeprozorske procedure dodavanjem aktivnosti u slučajuprijema poruke.

U proceduru WndProc() dodaće se kod kojiprikazuje ime programa kada se klikne mišem unutarprozora. Trenutno u WndProc postoji sljedeće:

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY

ako (obrada#1) { DefWindowProcA(lParam,wParam,m sg,hwnd); } inace {0;}

}

Da se obradi klik na lijevi taster miša, dodaje se obrada poruke WM_LBUTTONDOWN. Obrada poruke znači njenododavanje u WndProc kao na sljedećoj slici:

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY ako (msg=513) { ` DODANOobrada:=1;} ` Poruka WM_LBUTTONDOWN ` DODANO

ako (obrada#1) { DefWindowProcA(lParam,wParam,m sg,hwnd); } inace {0;}}

Sada treba napisati šta će se dogoditi kada se uđe u taj dio programa. Kod koji se želi dodati je prikaz imena datotekekorisničkog programima. U kasnijim primjerima će se samo prikazivati kod koji se želi integrisati u program, u cilju smanjenjakucanja.. GetModuleFileNameA (MAXPATH, szFileName, hIns tance); MessageBoxA(0, "This program is:",szFileName, hwnd);

Gore prikazani kod će se izvršiti kada se klikne mišem na formu programa i dodaje se u osnovnu Windows aplikaciju:

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY ako (msg=513) { ` GetModuleFileNameA (MAXPATH, szFileName, hIns tance); MessageBoxA(0, "This program is:",szFileName, hwnd); obrada:=1;} ` Poruka WM_LBUTTONDOWN `

ako (obrada#1) { DefWindowProcA(lParam,wParam,m sg,hwnd); } inace {0;}}

Nakon modifikacije ovog koda treba ga kompajlirati. Klik na prozor izaziva poruku sa imenom EXE programa.Dodane su varijable hInstance i szFileName. Prvi parametar funkcije GetModuleFIleName je HINSTANCE koji se odnosi naizvršni program (dakle EXE datoteka). Ta se vrijednost dobija funkcijom GetModuleHandle, koja za parametar NULL vraćaoznaku datoteke u kojoj se nalazi proces koji ju je pozvao. Drugi parametar funkcije je pokazivač na mjesto gdje će se primitiime datoteke i staza do navedenog modula i taj parametar je tima LPTSTR, odnosno pokazivač niz karaktera.:

Page 108: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

108#definiraj MAXPATH 260cijeli funkcija GetModuleFileNameA (cijeli a,karak ter * b,cijeli c);karakter [MAXPATH] szFileName;

MAX_PATH definiše maksimalnu veličinu imena datoteke.

Nakon poziva GetModuleFileName, bafer szFileName će se napuniti stringom koji sadrži ime naše EXE datoteke. Tajparametar se prosljeðuje funkciji MessageBox, čime se prikaže na ekranu..

Ukoliko dodavanje koda nije rezultovalo ispravnim kompajliranjem, slijedi kompletan kod.

cijeli funkcija RegisterClassExA(cijeli * wndclass) ;cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, ci jelic,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,c ijeli c,cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija LoadIconA ( cijeli a,cijeli b) ;cijeli funkcija DestroyWindow ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijelic,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b ,karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c );cijeli funkcija GetModuleHandleA ( cijeli a) ;#definiraj MAXPATH 260cijeli funkcija GetModuleFileNameA (cijeli a,karak ter *b,cijeli c);karakter [MAXPATH] szFileName;cijeli hInstance;karakter * klasa;slog { cijeli cbSize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wc; ` Klasa prozora cijeli hwnd; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } Msg; ` Poruka

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijelimsg, cijeli hwnd){ cijeli obrada; obrada:=0;

ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} `WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} `W M_DESTROY ako (msg=513) { ` GetModuleFileNameA (MAXPATH, szFileName, hIns tance); MessageBoxA(0, "This program is:",szFileName, hwnd); obrada:=1;} ` Poruka WM_LBUTTONDOWN `

ako (obrada#1) { DefWindowProcA(lParam,wParam,m sg,hwnd);} inace {0;}

}

` Glavni program{

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_AP PLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC _ARROW wc.hbrBackground := 6; `COLOR_WINDOW_FRAME wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_AP PLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registrac ija!",0); } inace {` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,120,140 , 100,200, 13565952, ` ,WS_OVERLAPPEDWINDOW "Windows aplikacija","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiran je!",0); } inace {

ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd); ` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; } }}

14.8. Šta je to poruka?

Razumijevanje petlje poruka i cijele strukture u kojoj se šalju poruke windows programa je od suštinskog značaja zapisanje svega osim najtrivijalnijih poruka. Sada će se malo više pažnje posvetiti cijelom procesu radi izbjegavanja kasnijihkonfuzija. Pogled na datoteke zaglavlja u kompajlerima za C pokazuje sljedeće definicije:

#define WM_INITDIALOG 0x0110#define WM_COMMAND 0x0111

#define WM_LBUTTONDOWN 0x0201

Poruke se koriste za komunikaciju između mnogih podsistema. Ukoliko se želi da neki prozor ili kontrola (koja jesamo specijalizovani prozor) obavi neku akciju, šalje joj se poruka. Drugi prozor može takođe da zahtjeve za aktivnosti našeg

Page 109: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

109prozora pozove porukom. Ako se dogodi kucanje na tastaturi ili pomicanje miša sistem šalje poruku prozoru na koji porukautiče. Zadatak prozorske procedure je da odgovori na navedene poruke.

Svaka poruka Windowsa može da ima do dva parametra, wParam i lParam. Unatoč imenu, pod Win32 oba parametrasu 32 bitna. Ove parametre ne koristi svaka poruka, a i one koje ih koriste mogu ih interpretirati na različite načine. Tako naprimjer, poruka WM_CLOSE ne koristi ni jedan parametar, a poruka WM_COMMAND koristi oba. U Parametru wParamkod poruke WM_COMMAND se u višoj riječi nalaz notifikacijska poruka, a u nižoj identifikator kontrole koja je poslalaporuku. U parametru lParam se nalazi handle prozora ili kontrole koji je poslao poruku.

Slanje poruke se vrši funkcijama PostMessage() ili SendMessage(). PostMessage() samo smjesti poruku u red čekanjai odmah se vrati, tako da poruka može ali i ne mora biti obrađena. SendMessage() šalje poruku direktno prozoru i ne vraća sedok prozor ne završi procesiranje poruke. Na ovaj način moguće je, na primjer, zatvoriti prozor slanjem poruke WM_CLOSEtom prozoru koristeći funkciju PostMessage(0,0,WM_CLOSE,hwnd);

14.9. Komunikacija sa dijaloškim prozorima

Dijaloškim prozorima se šalju poruke u svrhu komunikacije sa njim Poruka pojedinoj kontroli na dijalogu se možeposlati korištenjem funkcije GetDlgItem() koja na bazi identifikatora vraća hendl kontrole i zatim upotrebom funkcijeSendMessage () ili upotrebom SendDlgItemMessage() koja kombinuje oba koraka.

14.10. Šta je red čekanja poruka?

Ukoliko u trenutku obrade poruke WM_PAINT korisnik otkuca nešto na tastaturi, šta se treba dogoditi? Prekinutiiscrtavanje da bi se obradili tasteri ili ih ignorisati. Nijedno rješenje nije dobro, nego postoji red čekanja u koji se smještajuporuke kada se pošalju i nakon obrade ovih poruka one se uklanjaju. To omogućuje da se poruke ne gube dok se obrađujudruge poruke.

14.11. Šta je petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); }

Petlja poruka poziva GetMessage() koja pregleda red čekanja. Ako je red čekanja prazan, program se zaustavlja i čekada se poruka pojavi.

Kada se desi događaj koji ubacuje poruku u red čekanja (npr. pritisak na taster miša), GetMessage() vraća pozitivnuvrijednost indicirajući da postoji poruka koja se treba obraditi i da je ona napunjena članovima MSG strukture koja joj jedodijeljena. Ova funkcija vraća vrijednost 0 ako primi poruku WM_QUIT i negativnu vrijednost ako se dogodila greška.

Preuzimanje poruke u Msg varijablu i njeno prosljeđivanje funkciji TranslateMessage() je opcionalni korak kojiprevodi virtualni taster u karakterske poruke. Nakon što je to urađeno, poruka se prosljeđuje funkciji DispatchMessage(). Ovafunkcija provjeri kojem je prozoru namijenjena i traži prozorsku proceduru koja obrađuje taj prozor. Nakon toga poziva tuproceduru šaljući kao parametar hendl prozora, poruku, wParam i lParam.

U prozorskoj proceduri se provjeri poruka i njeni parametri i obrađuje po želji. Ukoliko se poruka posebno neobrađuje, poziva se DefWindowProc() koja obavlja podrazumijevane akcije, što često znači da se ništa ne radi.

Po završetku prozorske procedure, DispatchMessage() se vrati i petlja se ponovo izvršava. Prozorska procedura se nepoziva magično iz sistema, nju zapravo poziva korisnički program funkcijom DispatchMessage. Ukoliko se to želi, isti efekatse može postići korištenjem GetWindowLong() funkcije koja za navedeni hendl nalazi prozorsku proceduru i direktno je zvatiindirektnim pozivom funkcije. Ipak to neće raditi u složenijim aplikacijama, pošto su neki efekti koje implicitno radiDispatchMessage zanemareni.

Aplikacija provodi većinu vremena u petlji za poruke. Kada se želi izaći iz te petlje, GetMessage() treba da vrativrijednost 0 da se dođe do kraja WinMain funkcije. To obavlja PostQuitMessage(). Ona u red čekanja dodaje porukuWM_QUIT i umjesto vraćanja pozitivne vrijednosti GetMessage() puni Msg strukturu i vraća vrijednost 0. Polje wParamstrukture Msg sadrži vrijednost koja je proslijeđena funkciji PostQuitMessage i ona se može ili ignorisati ili iskoristiti kaoizlazni kod pri završetku procesa.

14.12. Rezime poglavlja

Aplikacije koje nemaju prozore se mogu pisati na klasični način. Windows aplikacije sa prozorima su bazirane napetljama i porukama. Svaka windows aplikacija, koja treba da prikaže standardni prozor ima četiri faze: pripremu i registracijuprozorske klase, kreiranje prozora, petlju poruka i obradu poruka u prozorskoj proceduri. Slanje poruke u glavnoj petljiautomatski pokreće proceduru za obradu prozora, a ova procedura je definisana u prozorskoj klasi.

Page 110: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

110

15. KORISNI ČKI INTERFEJS I GRAFIČKE PRIMITIVE

Jedan od najvažnijih zadataka aplikacija napisanih u bilo kom programskom jeziku je komunikacija sa korisnikom. Uovom poglavlju će biti riječi o tome kako se mogu primati ulazni podaci od korisnika pod operativnim sistemom Windows,prilagođeno za FILDZAN-32.Prema načinu interakcije sa korisnikom, postoje tri vrste aplikacija, servisi koji nemaju nikakvuinterakciju osim kroz konfiguracione datoteke ili Registry, konzolne aplikacije, koje komuniciraju preko tastature i tekstualnogizlaza i GUI aplikacije, koje imaju kompletan skup korisničkih kontrola.

15.1. Servisne aplikacije

Ovo su obično sistemski procesi koji se startaju automatski po startu operativnog sistema. Ove aplikacije direktno nekomuniciraju sa korisnikom, nego primaju poruke od sistema. Tako na primjer, aplikacije koje predstavljaju Web server neprikazuju ništa na ekranu, niti očitavaju išta sa tastature, nego obavljaju prijemom i slanjem podataka kroz socket funkcije.Servisne aplikacije u užem smislu se mogu startati i kada korisnik nije uopšte prijavljen na računar.

15.2. Konzolne aplikacije

Već su prvi primjeri u FILDZAN-32 koji su se uspjeli kompajlirati predstavljali ovakve aplikacije. Konzola jeinterfejs koji omogućava ulaz/izlaz aplikacijama koje rade u znakovnom režimu. Konzola se sastoji od ulaznog bafera i jednogili više ekranskih bafera. Ulazni bafer sadrži red ulaznih slogova od kojih svaki uključuje informacije u ulaznom događaju.Ekranski bafer je dvodimenzionalni niz znakova i informacija o boji za izlaz na prozoru konzole.

Win32 dopušta funkcije visokog i niskog nivoa za pristup konzoli. Funkcije visokog nivoa su orijentisane premaznakovima i omogućavaju redirekciju podataka. Funkcije niskog nivoa prate ulaze sa tastature kao što su pojedinačni tasteri,događaje miša i omogućuju bolju kontrolu izlaza na ekran.

Konzolne aplikacije se ne pišu ni na kakav poseban način. Treba jedino znati da jezik FILDZAN32 koji se razvijasam po sebi nema naredbe kao što su writeln ili scanf, pa treba napisati program koristeći Win32 API.

Najvažnije funkcije visokog nivoa su GetStdHandle , ReadConsoleA i WriteConsoleA, koje su objašnjene u testnimprimjerima šestog i sedmog poglavlja.

Od funkcija niskog nivoa treba spomenuti funkciju PeekConsoleInput kojom se mogu očitavati tasteri bez čekanja.

15.3. Grafi čke kontrole

Grafičke aplikacije imaju drugačiji pristup ulaznim podacima od tekstualnih. Na ekranu se nalaze različite kontrole(dugmad, editna polja, kombinovane liste i slično)

Sve Windows kontrole su zapravo prozori. To je bitno za znati, jer se tako mnoge funkcije namijenjene prozorimamogu koristiti i za kontrole. Tako na primjer, postavljanje naslova prozora ili upis podrazumijevane vrijednosti u editno poljeobavljaju iste funkcije.

Dva su pristupa pravljenju Windows kontrola. Jedan je preko resursnih dijaloga i zahtijeva upotrebu resursnog editoraili jezika za resursne skripte. Resursi se odvojeno kompajliraju i povezuju sa glavnim programom. To su binarni podaci kojiopisuju izgled kontrola. Prednost pristupa je u mogućnosti ekstrakcije ekranskih formi iz izvršnog programa u cilju njihovepopravke ili prevođenja na druge jezike. Druga prednost je što je osnovni program kraći. Treća prednost je što resursni editorimogu biti grafičke, vizuelne aplikacije, pa je njihova priprema razmjerno jednostavna. Nedostaci pristupa su potreba zaposebnim kompajlerom resursa i veća rasparčanost koda jer se on nalazi i u datoteci sa programom i u datoteci sa resursom.

Windows kontrole se mogu dobiti i direktnim pozivom CreateWindowExA funkcije za svaku kontrolu. Kako resursnikompajler za FILDZAN32 još nije napisan, koristiće se drugi metod.

Dio parametara iz CreateWindowExA koji su korišteni za kreiranje osnovne Windows aplikacije se mogu primijeniti iovdje, dok se drugi dio mijenja. Tako na primjer, za Windows kontrole nema potrebe registrovati klasu prozora, jer već postojinekoliko standardnih:

BUTTON - dugmad, checkbox-ovi i radio tasteri

LISTBOX – liste podataka

COMBOBOX - kombinovane liste podataka

EDIT - unosna polja

SCROLLBAR - klizna traka

Page 111: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

111STATIC - statični tekst

SysAnimate32- kontrola koja prikazuje AVI datoteku

msctls_hotkey32- kontrola koja predefiniše taster za brži pristup nekoj opciji

msctls_progress32- mjerač realizacije nekog posla

msctls_statusbar32 - statusna traka

ToolbarWindow32 - alatna traka

tooltips_class32 - informacioni prozorčić

msctls_trackbar32 - potenciometarska kontrola

msctls_updown32 - kontrola za unos podatka uz mogućnost uvećanja i umanjenja njegove vrijednosti tasterima

SysHeader32 - zaglavlje pogleda na podatke u formi liste

SysListView32 - Pogled na podatke u formi liste, koji omogućuje i pojedine ikone

SysTabControl32 - Tab kontrola, omogućuje prikaz podataka u formi odvojenih kartica

SysTreeView32 - Pogled stabla, hijerarhijski prikaz podataka

RichEdit - Omogućuje unos tekstova koji mogu biti u boji i sadržati dodatne podatke

Sa kontrolama se komunicira slanjem poruka kontroli funkcijom SendMessage ili odgovarajućim funkcijama zaobradu prozora.

Kontrole vraćaju prozoru poruku WM_COMMAND, WM_NOTIFY, WM_HSCROLL ili WM_VSCROLL, zavisnood same kontrole. U okviru wParam i lParam parametara nalaze se dodatne informacije koje govore o poruci.

15.4. Funkcije grafi čkih kontrola kroz primjer

Na slici Sl. 15.4.1 data je ekranska forma aplikacije za unos podataka o zainteresovanim licima za uvođenjekablovske televizije. Na ovoj formi se nalaze sve standardne Windows kontrole, koje se nalaze u USER32.DLL biblioteci.

Sl. 15.4.1. Forma aplikacijeNa ovoj formi se uočava da postoje kontrole tipa edit polja, listbox, combobox, checkbox, memo polja, menu,

dugmad, scroll bar, statički tekst, iscrtani logo firme, ispisani tekst i menu. Sada će se pogledati cijeli listing programa, a zatimvidjeti kako se definiše pojedina vrsta kontrola i kako se očitavaju podaci koje ona šalje.

Page 112: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

112

cijeli funkcija RegisterClassExA(cijeli * wndclass) ;cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, ci jelic,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,c ijeli c,cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija LoadIconA ( cijeli a,cijeli b) ;cijeli funkcija DestroyWindow ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijelic,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b ,karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c );cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli funkcija SendMessageA (karakter * a,cijeli b , cijelic, cijeli d);cijeli funkcija GetWindowTextA (cijeli a,karakter * b,cijeli c);cijeli funkcija IsDlgButtonChecked(cijeli a, cijeli b);cijeli funkcija SetScrollRange(cijeli a,cijeli b, c ijeli c,cijeli d, cijeli e);cijeli funkcija SetScrollPos(cijeli a,cijeli b, cij eli c,cijeli d);cijeli funkcija GetScrollPos(cijeli a,cijeli b);cijeli funkcija BeginPaint(cijeli * a,cijeli b);cijeli funkcija EndPaint(cijeli * a,cijeli b);cijeli funkcija Ellipse(cijeli a, cijeli b, cijeli c,cijelid, cijeli e);cijeli funkcija MoveToEx(cijeli * a, cijeli b, cije lic,cijeli d);cijeli funkcija LineTo(cijeli a, cijeli b, cijeli c );cijeli funkcija TextOutA(cijeli a,cijeli * b,cijeli c,cijelid,cijeli e);cijeli funkcija CreateMenu();cijeli funkcija CreatePopupMenu();cijeli funkcija AppendMenuA(karakter * a,cijeli b, cijeli c,cijeli d);cijeli funkcija SetMenu(cijeli a,cijeli b);

cijeli hInstance;karakter * klasa;slog { cijeli cbSize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wc; ` Klasa prozora cijeli hwnd; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } Msg; ` Poruka

slog { cijeli hdc; cijeli fErase; slog { cijeli left,top,right,bottom; } rcPaint; cijeli fRestore; cijeli fIncUpdate; cijeli [32] rgbReserved;} pstruct;

cijeli hEdit1,hEdit2,hGroup1,hRadio1,hRadio2,hCheck 1, hMemo1,hListBox1,hCombo1,hScroll1,hButton1,hStati c1,hStatic2,hStatic3,hStatic4,hStatic5,hStatic6,hdc,hM enu,hSubMenu;

cijeli funkcija KreirajKontrole(){ hEdit1:=CreateWindowExA(0,hInstance,0,hwnd,21,161 ,16,64, 1350565888, ` ws_child or ws_visible or ws_bord er "","EDIT",512);

hEdit2:=CreateWindowExA(0,hInstance,0,hwnd,21,161 ,48,64, 1350565888, ` ws_child or ws_visible or ws_bord er "","EDIT",512);

hGroup1:=CreateWindowExA(0,hInstance,0,hwnd,57,21 7,80,16, 1342177287, ` ws_child or ws_visible or bs_gr oupbox "Spol","BUTTON",0);

hRadio1:=CreateWindowExA(0,hInstance,105,hGroup1,17 ,113,16,24, 1342177289, ` ws_child or ws_visible orbs_autoradiobutton "Muški","BUTTON",0);

hRadio2:=CreateWindowExA(0,hInstance,106,hGroup1,17 ,113,32,24, 1342177289, ` ws_child or ws_visible orbs_autoradiobutton " Ženski","BUTTON",0);

hCheck1:=CreateWindowExA(0,hInstance,107,hwnd,17,20 9,152,16, 1342177283, ` ws_child or ws_visible or bs_aut ocheckbox "Uplatio uvo đenje","BUTTON",512);

hMemo1:=CreateWindowExA(0,hInstance,0,hwnd,89,185 ,216,16, 1350565892, ` ws_child or ws_visible or ws_bord er ores_multiline "Memo","EDIT",512);

hListBox1:=CreateWindowExA(0,hInstance,0,hwnd,97,20 0,24,272, 1352663043, ` ws_child or ws_visible or ws_bord er orlbs_standard "List1","LISTBOX",512);

SendMessageA("1.Samo TV program",0,384,hListBox1) ;` 384 LB_ADDSTRING SendMessageA("2.TV i Internet",0,384,hListBox1);` 384 LB_ADDSTRING SendMessageA("3.Samo Internet",0,384,hListBox1);` 384 LB_ADDSTRING SendMessageA("4.TV s kodiranimkanalima",0,384,hLi stBox1);` 384 LB_ADDSTRING SendMessageA("5.Puni paket",0,384,hListBox1);` 384 LB_ADDSTRING

hCombo1:=CreateWindowExA(0,hInstance,0,hwnd,100,145 ,144,272, 1350566402, ` ws_child or ws_visible or ws_bor der orcbs_dropdown or cbs_hasstrings "COmbobox1","COMBOBOX",0); SendMessageA("Maršala Tita",0,323,hCombo1);` 323 CB_ADDSTRING SendMessageA("Alipašina",0,323,hCombo1);` 323 CB_ADDSTRING

hScroll1:=CreateWindowExA(0,hInstance,0,hwnd,21,185 ,192,272, 1342177280, ` ws_child or ws_visible or sbs_ho rz "","SCROLLBAR",0); SetScrollRange(1,100,1,2,hScroll1);

hButton1:=CreateWindowExA(0,hInstance,0,hwnd,25,75 ,256,288, 1342177280, ` ws_child or ws_visible or bs_pus hbutton "Unesi","BUTTON",0);

hStatic1:=CreateWindowExA(0,hInstance,0,hwnd,14,5 7,16,8, 1342177291, `ws_child or ws_visible or ss_si mple "Prezime","STATIC",0);

hStatic2:=CreateWindowExA(0,hInstance,0,hwnd,14,3 7,50,8, 1342177291, `ws_child or ws_visible or ss_si mple "Ime","STATIC",0);

hStatic3:=CreateWindowExA(0,hInstance,0,hwnd,14,7 2,200,16, 1342177291, `ws_child or ws_visible or ss_si mple "Napomena","STATIC",0);

hStatic4:=CreateWindowExA(0,hInstance,0,hwnd,14,1 03,8,272,

Page 113: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

113 1342177291, `ws_child or ws_visible or ss_si mple "Vrsta usluge","STATIC",0);

hStatic5:=CreateWindowExA(0,hInstance,0,hwnd,14,78, 128,280, 1342177291, `ws_child or ws_visible or ss_si mple "Adresa","STATIC",0);

hStatic6:=CreateWindowExA(0,hInstance,0,hwnd,13,190 ,176,280, 1342177291, `ws_child or ws_visible or ss_si mple "Stepen realizacije","STATIC",0);

hMenu:=CreateMenu(); hSubMenu := CreatePopupMenu(); AppendMenuA( "O& programu",200,0,hSubMenu); AppendMenuA( "I&zlaz",201,0,hSubMenu); AppendMenuA("&Meni",hSubMenu,16,hMenu); SetMenu(hMenu,hwnd);

}

cijeli funkcija OnWMHScroll(cijeli wParam,cijeli lP aram){ cijeli nPos;

ako (lParam=hScroll1)& (wParam & 65535 =5) `SB_TH UMBTRACK { nPos:=wParam / 65536; SetScrollPos(1,nPos,2,hScroll1); }}

cijeli funkcija OnWMCommand(cijeli wParam,cijeli lP aram){ karakter [200] rezultat; cijeli nItem;

ako (lParam=0) { ako (wParam & 65535 = 201) { PostQuitMessage(0); } ako (wParam & 65535 = 200) { MessageBoxA(0,"O programu", "Ovo je aplikacija koja demonstrira kontrole i GDI",0); }

} ako (lParam=hButton1) { GetWindowTextA(200,rezultat,hEdit1); MessageBoxA(0,"Prezime",rezultat,hwnd); GetWindowTextA(200,rezultat,hEdit2); MessageBoxA(0,"Ime",rezultat,hwnd); GetWindowTextA(200,rezultat,hCombo1); MessageBoxA(0,"Adresa",rezultat,hwnd); GetWindowTextA(200,rezultat,hMemo1); MessageBoxA(0,"Napomena",rezultat,hwnd); ako IsDlgButtonChecked(105,hGroup1)=1 { MessageBoxA(0,"Spol","Muski",hwnd); } ako IsDlgButtonChecked(106,hGroup1)=1 { MessageBoxA(0,"Spol","Zenski",hwnd); }

ako IsDlgButtonChecked(107,hwnd)=1 { MessageBoxA(0,"Status","Platio",hwnd); } nItem := SendMessageA(0,0,392,hListBox1);` LB_GETCURSEL ako nItem=2 { MessageBoxA(0,"TV","Ne koristi TV",hwnd ); } ako (GetScrollPos(2,hScroll1)>50) { MessageBoxA(0,"Realizovanost","Preko 50",0) ; } }

}

cijeli funkcija OnWMPaint(cijeli hwnd){ hdc:=BeginPaint(&pstruct,hwnd); MoveToEx(0,250,400,hdc); LineTo(250,480,hdc); LineTo(310,480,hdc); LineTo(310,400,hdc); LineTo(250,400,hdc); TextOutA(5,"CBLTV",253,403,hdc); Ellipse(294,470,264,410, hdc); EndPaint(&pstruct,hwnd);}

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijelimsg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;}` WM_CLOSE ako (msg=15){ OnWMPaint(hwnd); obrada:=1;}` WM_ PAINT ako (msg=2) {PostQuitMessage(0); obrada:=1;}` W M_DESTROY ako (msg=273) {OnWMCommand(wParam,lParam); obra da:=1;} ` Poruka WM_COMMAND ako (msg=276) {OnWMHScroll(wParam,lParam); obra da:=1;}` Poruka WM_HSCROLL

ako (obrada#1) { DefWindowProcA(lParam,wParam,m sg,hwnd);} inace {0;}

}

` Glavni program{

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_AP PLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC _ARROW wc.hbrBackground := 5; `SIVA wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_AP PLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registrac ija!",0); } inace {` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,383,535 , 177,108, 13565952, ` WS_OVERLAPPEDWINDOW "Forma za unos","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiran je!",0); } inace { KreirajKontrole(); ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd); ` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; } }}

Sl. 15.4.2. Aplikacija sa podprozorima -kontrolama

Page 114: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

114Na listingu Sl. 15.4.2 se vidi da se registracija prozorske klase uopšte nije promijenila, izuzev boje pozadine. Dijelu

koda za kreiranje prozora je dodan poziv funkcije KreirajKontrole nakon što je kreiran glavni program, dok je glavna petljaporuka identična osnovnoj verziji. Prozorska procedura obrađuje pet poruka.

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wPara m, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;}` WM_CLOSE ako (msg=15){ OnWMPaint(hwnd); obrada:=1;}` WM_ PAINT ako (msg=2) {PostQuitMessage(0); obrada:=1;}` W M_DESTROY ako (msg=273) {OnWMCommand(wParam,lParam); obra da:=1;} ` Poruka WM_COMMAND ako (msg=276) {OnWMHScroll(wParam,lParam); obra da:=1;}` Poruka WM_HSCROLL ako (obrada#1) { DefWindowProcA(lParam,wPar am,msg,hwnd); } inace {0;}}

Poruka WM_COMMAND (broj 273) se šalje glavnom prozoru svaki put kada se izabere neka opcija na meniju ilipritisne neki ekranski taster, radio taster ili checkbox. Ova poruka uz parametre wparam i lparam šalje dodatne vrijednosti kojiodređuju kontrolu.

Poruka WM_PAINT (broj 15) se šalje glavnom prozoru svaki put kada se treba iscrtati dio prozora.

Horizontalne klizne trake (scrollbar) šalju poruke WM_HSCROLL (broj 276).

15.5. Meniji

Kreiranje menija se vrši funkcijom CreateMenu(), a podmenija funkcijom CreatePopupMenu(). Ove funkcije internokreiraju menije, i dodijele mu identifikator, handle. To se vidi na dijelu koda koji se nalazi na kraju funkcije KreirajKontrole()

hMenu:=CreateMenu(); hSubMenu := CreatePopupMenu(); AppendMenuA( "O& programu",200,0,hSubMenu); AppendMenuA( "I&zlaz",201,0,hSubMenu); AppendMenuA("&Meni",hSubMenu,16,hMenu); SetMenu(hMenu,hwnd);

Za dodavanje opcija menija koristi se funkcija AppendMenuA, čiji prvi parametar predstavlja tekst opcije, drugiparametar predstavlja broj koji će meni proslijediti uz poruku WM_COMMAND ili handle podmenija. Treći parametarpredstavlja status menija i ima vrijednost 0 ako je riječ o opciji, a 16 ako je riječ o podmeniju. Moguće je još mnogo različitihstatusa. Posljednji parametar predstavlja handle menija ili podmenija kome se pridružuje ova opcija.

Meni se dodjeljuje prozoru primjenom opcije SetMenu, čiji je prvi parametar handle menija, a drugi je handleprozora.

Izbor opcije u meniju šalje glavnom prozoru poruku WM_COMMAND. Odgovor na opcije se vidi u sljedećem dijelukoda unutar funkcije OnWMCommand

ako (lParam=0) { ako (wParam & 65535 = 201) { PostQuitMessage(0); } ako (wParam & 65535 = 200) { MessageBoxA(0,"O programu", "Ovo je aplikacija koja demonstrira kontrole i GDI",0); } }

Poruka WM_COMMAND koja je stigla od menija u parametru lParam ima vrijednost 0, a nižih 16 bita parametrawParam predstavlja konstantu koja je data uz drugi parametar funkcije AppendMenuA.

15.6. Dugme - Button

Kontrola oblika dugmeta se kreira kao i svaki prozor, CreateWindowExA funkcijom. U našem primjeru, to je naredba

hButton1:=CreateWindowExA(0,hInstance,0,hwnd,25,75, 256,288, 1342177280, ` ws_child or ws_visible or bs_pus hbutton "Unesi","BUTTON",0);

Kao što se vidi, klasa prozora je BUTTON, a stil je kombinacija ws_child , ws_visible i bs_pushbutton. Trećiparametar je hwnd, što znači da je riječ o kontroli koja ima roditelja, tj. prozor kome će se slati poruke. Posljednji parametar je0 što znači da nema specijalnog okvira.

Prepoznavanje da je taster pritisnut može se vršiti u obradi poruke WM_COMMAND, što se vidi iz sljedećeg dijelakoda unutar funkcije OnWMCommand:

Page 115: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

115 ako (lParam=hButton1) { ... }

Parametar lParam poruke WM_COMMAND sadrži handle tastera koji je pritisnut, hButton1. U okviru obrade ovogtastera se nalazi kod koji očitava vrijednosti svih kontrola i prikazuje ih na ekranu koristeći MessageBoxA.

15.7. Editna i memo polja

Najvažnija kontrola za unos podataka su polja za unos teksta ili editna polja. Ove kontrole imaju klasu EDIT kao usljedećem dijelu koda

hEdit1:=CreateWindowExA(0,hInstance,0,hwnd,21,161,1 6,64, 1350565888, ` ws_child or ws_visible or ws_bord er "","EDIT",512);

hEdit2:=CreateWindowExA(0,hInstance,0,hwnd,21,161 ,48,64, 1350565888, ` ws_child or ws_visible or ws_bord er "","EDIT",512);

Memo polja se razlikuju od običnih editnih polja po tome što imaju dodatni stil es_multiline

hMemo1:=CreateWindowExA(0,hInstance,0,hwnd,89,185,2 16,16, 1350565892, ` ws_child or ws_visible or ws_bord er or es_multiline "Memo","EDIT",512);

Očitavanje vrijednosti kontrole se svodi na čitanje naslova prozora funkcijom GetWindowTextA unutar obradepritiska na dugme. Prvi argument ove funkcije je broj bajtova koliki tekst treba da bude, drugi je adresa na koju se tekstsmješta a treći je hendl kontrole. U sljedećem dijelu koda se primljeni podaci prikazuju u poruci (prava aplikacija bi ih upisalau bazu podataka)

GetWindowTextA(200,rezultat,hEdit1); MessageBoxA(0,"Prezime",rezultat,hwnd); GetWindowTextA(200,rezultat,hEdit2); MessageBoxA(0,"Ime",rezultat,hwnd); GetWindowTextA(200,rezultat,hCombo1); MessageBoxA(0,"Adresa",rezultat,hwnd); GetWindowTextA(200,rezultat,hMemo1); MessageBoxA(0,"Napomena",rezultat,hwnd);

U složenijim slučajevima editno polje treba dodatno kontrolisati, recimo zabranjujući da se nenumeričke vrijednostiuopšte mogu otkucati. To se radi obradom poruka koje editno polje direktno šalje glavnom prozoru.

15.8. Grupe kontrola i radio tasteri

Radio tasteri su okruglog oblika i omogućavaju izbor jedne od više opcija. Svaki radio taster predstavlja posebanprozor klase BUTTON. Da bi se znalo između kojih radio tastera se odabira opcija, formira se grupa tastera (group box) koja jetakođe prozor klase BUTTON, ali sa kombinacijom stilova ws_child, ws_visible i bs_groupbox, kao što se vidi iz dijela koda:

hGroup1:=CreateWindowExA(0,hInstance,0,hwnd,57,217, 80,16, 1342177287, ` ws_child or ws_visible or bs_gr oupbox "Spol","BUTTON",0);

Radio tasteri imaju kombinaciju stilova ws_child, ws_visible i bs_autoradiobutton. Ono što je bitno primijetiti da seza roditeljski prozor ne navodi handle od glavnog prozora, nego od grupe tastera hGroup1, te da su koordinate relativne uodnosu grupu kontrola. Pored toga, svaki radio taster treba da ima svoju specijalnu numeričku oznaku koja je treći parametar ikoja u narednim linijama ima vrijednosti 105, odnosno 106.

hRadio1:=CreateWindowExA(0,hInstance,105,hGroup1, 17,113,16,24, 1342177289, ` ws_child or ws_visible or bs_auto radiobutton "Muški","BUTTON",0);

hRadio2:=CreateWindowExA(0,hInstance,106,hGroup1, 17,113,32,24, 1342177289, ` ws_child or ws_visible or bs_aut oradiobutton " Ženski","BUTTON",0);

Očitavanje vrijednosti radio tastera se vrši funkcijom IsDlgButtonChecked, čiji prvi argument ima vrijednost ranijenavedene numeričke oznake, a drugi je handle na grupu tastera. Ako je taster izabran, ova će funkcija vratiti tačnu vrijednost,što se vidi na sljedećem dijelu koda.

ako IsDlgButtonChecked(105,hGroup1)=1 { MessageBoxA(0,"Spol","Muski",hwnd); } ako IsDlgButtonChecked(106,hGroup1)=1 { MessageBoxA(0,"Spol","Zenski",hwnd); }

Page 116: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

11615.9. Kontrolne ku ćice (checkbox)

Kontrolnom kućicom (checkbox) se omogućuje unos podataka koji imaju vrijednosti tipa tačno/netačno. Ovakomponenta se kreira kao i obični tasteri (prozor klase BUTTON) uz stil koji je kombinacija stilova ws_child, ws_visible ibs_autocheckbox. I kod ove komponente je potrebno navesti internu oznaku (koja u sljedećem dijelu koda ima vrijednost 107)

hCheck1:=CreateWindowExA(0,hInstance,107,hwnd,17,20 9,152,16, 1342177283, ` ws_child or ws_visible or bs_aut ocheckbox "Uplatio uvo đenje","BUTTON",512);

Očitavanje vrijednosti ove komponente se takođe vrši funkcijom IsDlgButtonChecked, kao u sljedećem dijelu koda:

ako IsDlgButtonChecked(107,hwnd)=1 { MessageBoxA(0,"Status","Platio",hwnd); }

15.10. Liste podataka (listbox)

Liste podataka (listbox) služe za izbor podataka poredanih jedan iznad drugog. I ova kontrola se kreira kao prozor, alikoji je klase LISTBOX. Stil je kombinacija ws_child , ws_visible , ws_border i lbs_standard. Kreiranom listboxu, treba poslativrijednosti koristeći funkciju SendMessageA. Prvi argument ove funkcije (lParam) je pointer na niz karaktera koji se dodaje ulistbox, drugi je 0 (wParam), treći je 384 ( poruka LB_ADDSTRING) a četvrti je handle na listbox.

hListBox1:=CreateWindowExA(0,hInstance,0,hwnd,97,20 0,24,272, 1352663043, ` ws_child or ws_visible or ws_bord er or lbs_standard "List1","LISTBOX",512);

SendMessageA("1.Samo TV program",0,384,hListBox1) ; ` 384 LB_ADDSTRING SendMessageA("2.TV i Internet",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("3.Samo Internet",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("4.TV s kodiranimkanalima",0,384,hLi stBox1); ` 384 LB_ADDSTRING SendMessageA("5.Puni paket",0,384,hListBox1); ` 3 84 LB_ADDSTRING

Da bi se saznalo koja je opcija listbox-a odabrana, pošalje se poruka LB_GETCURSEL (392) listboxu uz lparam iwparam parametre jednake 0.

nItem := SendMessageA(0,0,392,hListBox1); ` L B_GETCURSEL ako nItem=2 { MessageBoxA(0,"TV","Ne koristi TV",hwnd ); }

15.11. Kombinovane liste (combo box)

Kombinovanjem listboxa i editnog polja dobija se combo box. On je prozor klase COMBOBOX, i kreira se i punislično LISTBOXu, s tim što je stil prozora kombinacija ws_child, ws_visible, ws_border, cbs_dropdown i cbs_hasstrings akod poruke za punjenje 323 (cb_addstring). Nazivi ulica su stavljeni u combobox koji je tipa dropdown, što znači da je mogućedokucavati uneseni tekst. Druga dva tipa su simple koji je fiksnog izgleda i dropdownlist koji je promjenjive veličine, ali jetekst moguće samo izabrati, ne i dokucavati.

hCombo1:=CreateWindowExA(0,hInstance,0,hwnd,100,145 ,144,272, 1350566402, ` ws_child or ws_visible or ws_bor der or cbs_dropdown or cbs_hasstrings "COmbobox1","COMBOBOX",0); SendMessageA("Maršala Tita",0,323,hCombo1); ` 323 CB_ADDSTRING SendMessageA("Alipašina",0,323,hCombo1); ` 323 CB _ADDSTRING

Očitavanje stringa koji je izabran u ComboBoxu se može obaviti očitavanjem naslova prozora.

MessageBoxA(0,"Adresa",rezultat,hwnd); GetWindowTextA(200,rezultat,hMemo1);

15.12. Statički tekst

Pored odgovora na WM_PAINT poruku, statički tekst se takođe može realizovati u formi podprozora klase static. Oiscrtavanju ovakvih tekstova na formama brine kasnije sam Windows.

hStatic1:=CreateWindowExA(0,hInstance,0,hwnd,14,57, 16,8, 1342177291, `ws_child or ws_visible or ss_si mple "Prezime","STATIC",0);

hStatic2:=CreateWindowExA(0,hInstance,0,hwnd,14,3 7,50,8, 1342177291, `ws_child or ws_visible or ss_si mple "Ime","STATIC",0);

hStatic3:=CreateWindowExA(0,hInstance,0,hwnd,14,7 2,200,16, 1342177291, `ws_child or ws_visible or ss_si mple "Napomena","STATIC",0);

hStatic4:=CreateWindowExA(0,hInstance,0,hwnd,14,1 03,8,272, 1342177291, `ws_child or ws_visible or ss_si mple

Page 117: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

117 "Vrsta usluge","STATIC",0);

hStatic5:=CreateWindowExA(0,hInstance,0,hwnd,14,7 8,128,280, 1342177291, `ws_child or ws_visible or ss_si mple "Adresa","STATIC",0);

hStatic6:=CreateWindowExA(0,hInstance,0,hwnd,13,1 90,176,280, 1342177291, `ws_child or ws_visible or ss_si mple "Stepen realizacije","STATIC",0);

15.13. Klizna traka (scrollbar)

Iako se daleko češće koristi za pregled velikih slika ili skupova korisničkih kontrola koje ne mogu stati na ekran,horizontalna klizna traka se može koristiti i za unos podataka čija vrijednost nije egzaktna nego približna. Pomicanje kliznetrake izaziva poruku WM_HSCROLL (broj 276). U programu je ova poruka obrađena u funkciji OnWMHScroll

cijeli funkcija OnWMHScroll(cijeli wParam,cijeli lP aram){ cijeli nPos;

ako (lParam=hScroll1)& (wParam & 65535 =5) `SB_TH UMBTRACK { nPos:=wParam / 65536; SetScrollPos(1,nPos,2,hScroll1); }}

Postoji više načina pomicanja klizne trake, povlačenjem kvadratića na njoj, klikom na strelice ili klikom u praznapolja. Ovdje je obrađeno samo povlačenje kvadratića (u nižoj riječi wParama vrijednost 5, poruka SB_THUMBTRACK).Prilikom povlačenja kvadratića na kliznoj traci(ali samo u tom slučaju), viša riječ parametra wparam će sadržati novu poziciju.Ta pozicija neće biti zadržana ako se ne pozove funkcija SetScrollPos, čiji prvi parametar znači da li će se klizna traka ponovoiscrtati, drugi parametar definiše njenu novu poziciju. Treći parametar govori da li je riječ o horizontalnoj kliznoj traci,vertikalnoj kliznoj traci samog prozora ili odvojenoj kontroli (vrijednost 2). Četvrti parametar je handle na kliznu traku.

Trenutna pozicija klizne trake se dobija funkcijom GetScrollPos, čiji prvi parametar predstavlja vrstu klizne trake (unašem slučaju 2, odvojena kontrola), a drugi je hendl na kliznu traku. U ovom dijelu koda se provjerava da li klizna traka imavrijednost preko 50.

ako (GetScrollPos(2,hScroll1)>50) { MessageBoxA(0,"Realizovanost","Preko 50",0) ; }

15.14. Iscrtane slike i WM_PAINT poruka

Za iscrtavanje grafike postoji jedan poseban podsistem koji se zove GDI, graphic device interface. On omogućavaširok izbor grafičkih elemenata kao što su linije, krugovi, elipse, ispunjeni likovi, bitmape, tekstualne poruke, i slično

Većina ovih funkcija koristi jedan specijalni identifikator dijela prozora po kome se crta, koji se zove hdc (handle todevice context - kontekst uređaja). On se dobija pozivom odgovarajućih funkcija iz hendla na prozor, hwnd. Razlog zbog čegaAPI funkcije za crtanje razdvajaju prozor od njegovog konteksta uređaja je u činjenici da prozor ima okvir i korisnu površinu ida crtanje po korisnoj površini ne mijenja sadržaj okvira i obrnuto.

Nije, međutim dobro iscrtavati sliku bilo kada. Iscrtavanje drugih prozora u sistemu lako prekriva iscrtanu sliku, pa seono što je iscrtano izgubi. Stoga je iscrtavanje potrebno obaviti svaki put kada je primljena poruka WM_PAINT (poruka broj15). Ovu poruku šalje sistem kada je prozor doživio takvu promjenu da ga je potrebno ponovo crtati (recimo, otkriven nakonšto je bio prekriven ili su mu promijenjene dimenzije.

Unutar funkcije OnWMPaint iscrtava se predviđeni lik. Funkcijom BeginPaint, koja ima dva parametra: struktura zacrtanje i handle na prozor, daje se informacija Windowsu da se počinje sa iscrtavanjem. Struktura za crtanje je slog koji sadržiinformacije o pravougaoniku koji se iscrtava. Rezultat funkcije BeginPaint je handle na kontekst uređaja (device context).Crtanje se završava funkcijom EndPaint koja ima iste argumente.

cijeli funkcija OnWMPaint(cijeli hwnd){ hdc:=BeginPaint(&pstruct,hwnd); MoveToEx(0,250,400,hdc); LineTo(250,480,hdc); LineTo(310,480,hdc); LineTo(310,400,hdc); LineTo(250,400,hdc); TextOutA(5,"CBLTV",253,403,hdc); Ellipse(294,470,264,410, hdc); EndPaint(&pstruct,hwnd);}

Između funkcija BeginPaint i EndPaint mogu se vidjeti funkcije za crtanje. Prvi parametar funkcije MoveToEx, kojasluži za postavljanje početne tačke je pointer na slog koji bi vratio prethodne koordinate ili vrijednost 0 ukoliko prethodnekoordinate nije potrebno očitavati. Drugi parametar predstavlja y koordinatu tačke, treći parametar predstavlja x koordinatu, a

Page 118: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

118četvrti hendl na kontekst uređaja. Tačka postavljena funkcijom MoveToEx je početna tačka za iscrtavanje linija. Linije se daljeiscrtava do tačke čije su y i x koordinate navedene kao prvi i drugi parametar funkcije LineTo. Krajnja tačka tako iscrtanelinije postaje početna tačka za novu liniju.

Ispis teksta se obavlja funkcijom TextOutA. Prvi argument ove funkcije je broj bajtova koliko je velik string koji seispisuje, drugi je sam string, treći i četvrti su same koordinate stringa a posljednji je handle na kontekst uređaja.

Moguće je iscrtavati i elipse. Funkcija Ellipse za argumente ima redom: y koordinatu donjeg desnog ugla kvadratakoji je opisuje, x koordinatu donjeg desnog ugla kvadrata koji je opisuje, y koordinatu gornjeg lijevog ugla kvadrata koji jeopisuje, x koordinatu donjeg lijevog ugla kvadrata koji je opisuje i handle na kontekst uređaja.

15.15. Rezime poglavlja

Pod windowsom kontrole su takođe prozori. Svaka kontrola se kreira funkcijom CreateWindowExA i ima nekolikopredefinisanih klasa. Sve kontrole osim radio tastera trebaju da za roditelja imaju glavni prozor. Radio tasteri se smještaju ugrupe. Podaci koje kontrole šalju se očitavaju na različite načine. Dodatno iscrtani grafički elementi se trebaju crtati kaoodgovor na poruku WM_PAINT. Sve funkcije za crtanje dio su podsistema koji se zove GDI i kao argument imaju handle nakontekst uređaja koji se prosljeđuje kao zadnji argument funkcija za crtanje.

- .

Page 119: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

119

16. SPISAK WIN32API FUNKCIJA

U prethodnim poglavljima upoznato je sa osnovama Windows API-ja. Sada slijedi spisak svih API funkcija kojesavremene verzije Windowsa pružaju.

16.1. Najvažniji podsistemi Windows API-ja

Windows API je kompilacija različitih skupova funkcija namijenjenih programerima. Najvažniji njegovi dijelovi su:

- Windows Kernel

- Korisnički interfejs

- Grafički podsistem GDI

- Funkcije za slanje poruka MAPI

- Funkcije za rad sa interfejsom za telefon TAPI

- COM, objektni model za kooperaciju odvojenih aplikacija

- OLE/Active X, nadgradnja COMa za pravljenje aplikacija čije su komponente druge aplikacije

- ODBC, funkcije za pristup bazama podataka

- Kontrole unaprijeđenog korisničkog interfejsa

- DirectX, nadgradnja COMa za direktni pristup grafičkom hardveru i zvuku

- RASAPI za pristup preko modema

- Winsock za pravljenje Internet aplikacija

-MCI, za pristup multimedijalnim uređajima.

-OPENGL za trodimenzionalnu grafiku

- Standardni dijalozi

Api funkcija ima mnogo i jedini način da se one nauče je analizom gotovih programa. Stoga većina Windows APIaplikacija ima standardan izgled. Tako na primjer, ODBC aplikacije izgledaju kao na slici Sl. 16.1.1:

Sl. 16.1.1. Osnovna ODBC aplikacija

Page 120: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

120

16.2. DLL datoteke u kojima se nalaze funkcije

Standardnim API funkcijama windowsa smatraju se one koje se nalaze u sljedećim DLL datotekama:

ACLUI.DLL Korisni čki interfejs za kontrolu pravapristupaACTIVEDS.DLL Active Directory ServicesADVAPI32.DLL Razni sistemski pozivi uklju čujućisigurnost i registrybdnapi.DLL Web TV bibliotekabignums.dll Ra čun sa velikim brojevimaCAP.DLL DijagnostikaCOMCTL32.DLL Savremene kontrole korisni čkog interfejsaCOMDLG32.DLL Standardni dijaloziCRTDLL.DLL Standardna C biblioteka, printf, sin it dCRYPT32.DLL Kriptografske funkcijectl3d32.dll Trodimenzionalni izgled kontrolad3dim.DLL Proširenje arhitekture Direct3DD3DRM.DLL Direct3D vektorske funkcijed3dxof.DLL Direct3D aplikacijska bibliotekadapi.DLL Za pristup direktoriju MS Exchangeaddraw.dll Direct Draw, glavna datotekadflayout.dll Definisanje rasporeda podataka u slo ženiimdokumentimaDINPUT.DLL DirectInput (za DirectX pristup joysti cku,tastaturi, mišu)dlcapi.dll Pristupanje DLC protokolu za HP mre žneštampa čeDPLAY.DLL DirectPlay, za igranje preko mre žeDPLAYX.DLL DirectPlay, proširenjeDSETUP.DLL Za instalaciju DirectXDSOUND.DLL DirectSound, zvuk u DirectXdynloader.dll Analiza OBJ datotekaedbbcli.DLL Alatke za MS Exchange servergc.dll Garbage collectorGDI32.DLL Grafi čke biblioteke za prikaz linija ibitmapaglide2x.dll 3D biblioteka za 3DFX 3D grafi čkeakceleratoreglu32.dll Pomo ćne funkcije koje OpenGL aplikacijekoriste za prikaz 3D grafikeGLUT32.DLL Varijanta OpenGL sa izmjenjenim imenimafunkcijaHLINK.DLL Rad sa hiperlinkovimaICMP.DLL Za komandu PINGICMUI.DLL Korisni čki interfejs za Microsoft ColorMatching Systemimagehlp.dll Za analiziranje EXE datotekaIMM32.DLL Unošenje azijskih UNICODE znakovaiphlpapi.DLL Informacije o mre žnoj konfiguraciji istatisticiIPROP.DLL Implementacija OlePropertySetKERNEL32.DLL Upravljanje memorijom i I/O operacijam aloadperf.dll Upravljanje perfomance monitoromLSAPI32.DLL Informacije o licenciranjulz32.dll Kompresija podatakamapi32.dll Slanje i obrada EMAIL porukamgmtapi.DLL Biblioteka za upravljanje resursima pre koSNMPMPR.DLL Punjenje Network Neighboorhooda spiskommašinaMPRAPI.DLL Pristup funkcijama za rutiranjeMSACM32.DLL Upravljanje audio kompresijommscms.DLL Color Matching biblioteka (prilikom šta mpe)MSI.DLL Windows InstallerMSLSP32.DLL Informacije o licenciranjuMSVCRT.DLL Microsoft C runtime bibliotekaMSVCRTD.DLL Microsoft C runtime biblioteka, debugverzija

MSVFW32.DLL Video for WindowsMSWSOCK.DLL Microsoftove nestandardne Winsock funkc ijeNAL.DLL Sloj abstrakcije mre ženetapi32.dll Za pristup Microsoftovim mre žamaNTDLL.DLL Za pristup internim funkcijama Windowsa NTNTMSAPI.DLL Removable Storage API (proširenje disko vatrakama)

ODBC32.DLL Pristup bazama podatakaODBCCP32.dll Podešavanje ODBCole32.dll Osnovne OLE funkcijeOLEAUT32.DLL Ole automatizacijaoledlg.DLL OLE dijalozi (Insert Object)OLEPRO32.DLL Microsoftove vlastite OLE funkcijeopengl.dll Silicon Graphics OpenGL bibliotekaopengl32.dll Microsoft OpenGL Bibliotekapdh.dll Performance Data Helperpenwin32.dll Za Windows koji se upravlja olovkompkdp32.dll Za Windows koji se upravlja olovkomPSAPI.DLL Spisak procesa koji se izvršavajuRASAPI32.DLL RAS Pristup sistemu preko modemarasdlg.dll Dijalozi koji se koriste u RASrassapi.dll RAS administracijske funkcijeRESUTILS.DLL Pristup Windows resursimaRICHED20.DLL RichEdit kontrolarpcns4.dll Name Service u pozivu udaljene procedure(RPC)RPCRT4.DLL API za poziv udaljene procedureRTM.DLL Upravlja č tabelom rutiranjaSecur32.DLL Windows sigurnosne funkcijeSETUPAPI.DLL Instalacija WindowsaSHELL32.DLL Veza izme đu aplikacije i FileManagera,ExploreraSHFOLDER.DLL Pristup specijalnim folderima (MyDocuments)SHLWAPI.DLL Pomo ćne funkcije za pristup stazama,urlovima, registriju i bojamasnmpapi.dll Pristup SNMP funkcijama za pra ćenje mreže iserverasvrapi.dll Kontrola dijeljenih (share) resursa naMicrosoft mre žitapi32.dll Telefonski APITOOLHELP.DLL Funkcije za debagiranje i pra ćenje sistemaURL.DLL Pokretanje Web browsera preko URL adre seURLMON.DLL Proširenje OLE32USER32.DLL Najbitnije funkcije za rad sa prozorim a ikontrolamaUSERENV.DLL Pristup korisni čkim profajlovimaversion.dll Informacije o broju verzije izvršnogprogramawebpost.dll Slanje Web stranica na internetwin32spl.dll Pristup printer spooleruWINFAX.DLL Rad sa telefaxomWININET.DLL Microsoft Internet funkcijewinmm.dll Windows multimedia APIwintrust.dll Autentifikacija tajnim i javnim klju čemWOW32.dll Podrška 16 bitnim aplikacijamaWS2_32.DLL Winsock 2.0wsock32.dll Winsock APIwst.dll Working Set Tuner (optimalan broj stra nicau RAMu)

16.3. Spisak API funkcija

Sada su navedene sve dokumentovane funkcije koje se nalaze u pojedinim bibliotekama, a koje je moguće pozvati izFILDZAN-32 ili drugih programskih jezika. Puna sintaksa svake od njih, namjena i način korištenja mogu se naći na Internetuili na CD-ovima Microsoft Developers Network. Ovdje su navedeni ime funkcije, biblioteka, oznaka NM/AW, broj parametarai kratki opis funkcije. Ako je navedena oznaka AW, tada se pri deklaraciji i pozivu funkcije njenom imenu dodaje slovo A zaAscii stringove ili W za Unicode stringove (npr CreateWindowEx se u Fildzan32 piše CreateWindowExA). Pri oznaci NMovog sufiksa nema.

Page 121: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

121

AbortDoc,GDI32.DLL,NM,1, stops the current print job and erases everything drawn since thelast call to the StartDoc function.AbortPath,GDI32.DLL,NM,1, closes and discards any paths in the specified device context.AbortPrinter,WINMM.DLL,NM,1, deletes a printer?s spool file if the printer is configured forspooling.AbortSystemShutdown,ADVAPI32.DLL,AW,1, stops a system shutdown started by using theInitiateSystemShutdown function.accept,WS2_32.DLL,NM,3, extracts the first connection on the queue of pending connectionson socket s.accept,WSOCK32.DLL,NM,3, extracts the first connection on the queue of pending connectionson socket s.AcceptEx,MSWSOCK.DLL,NM,8, combines several socket functions into a single API/kerneltransition.AcceptEx,WSOCK32.DLL,NM,8, combines several socket functions into a single API/kerneltransition.AcceptSecurityContext,SECUR32.DLL,NM,9,This function enables the server part of atransport application to establish a security context between the server and a remote client.AccessCheck,ADVAPI32.DLL,NM,8 is used by a server application to check aclient?s access toan object against the access control associatedwith the object.AccessCheckAndAuditAlarm,ADVAPI32.DLL,AW,11, performs an access validation andgenerates corresponding audit messages.AccessNtmsLibraryDoor,NTMSAPI.DLL,NM,3, unlocks the door of the specified library. If thelibrary is busy, RSM queues the request and returns successfully.acmDriverAdd,MSACM32.DLL,AW,5, adds a driver to the list of available ACM drivers.acmDriverClose,MSACM32.DLL,NM,2, closes a previously opened ACM driver instance.acmDriverDetails,MSACM32.DLL,AW,3, queries a specified ACM driver to determine itscapabilities.acmDriverEnum,MSACM32.DLL,NM,3 enumerates the available ACM drivers,continuing untilthere are no more drivers or the callback functionreturns FALSE.acmDriverID,MSACM32.DLL,NM,3 returns the handle of an ACM driveridentifier associatedwith an open ACM driver instance or streamhandle.acmDriverMessage,MSACM32.DLL,NM,4 sends a user-defined message to a given ACM driverinstance.acmDriverOpen,MSACM32.DLL,NM,3 opens the specified ACM driver andreturns a driverinstance handle that can be used to communicatewith the driver.acmDriverPriority,MSACM32.DLL,NM,3, modifies the priority and state of an ACM driver.acmDriverRemove,MSACM32.DLL,NM,2, removes an ACM driver from the list of availableACM drivers.acmFilterChoose,MSACM32.DLL,AW,1, creates an ACM-defined dialog box that enables theuser to select a waveform-audio filter.acmFilterDetails,MSACM32.DLL,AW,3 queries the ACM for details about a filter with a specificwaveform-audio filter tag.acmFilterEnum,MSACM32.DLL,AW,5, enumerates waveform-audio filters available for a givenfilter tag from an ACM driver.acmFilterTagDetails,MSACM32.DLL,AW,3, queries the ACM for details about a specificwaveform-audio filter tag.acmFilterTagEnum,MSACM32.DLL,AW,5, will return MMSYSERR_NOERROR (zero) if no filtertags are to be enumerated.acmFormatChoose,MSACM32.DLL,AW,1 function creates an ACM-defined dialog box thatenables the user to select a waveform-audio format.acmFormatDetails,MSACM32.DLL,AW,3, queries the ACM for format details for a specificwaveform-audio format tag.acmFormatEnum,MSACM32.DLL,AW,5, enumerates waveform-audio formats available for agiven format tag from an ACM driver.acmFormatSuggest,MSACM32.DLL,NM,5 queries the ACM or a specified ACMdriver tosuggest a destination format for the supplied sourceformat.acmFormatTagDetails,MSACM32.DLL,AW,3, queries the ACM for details on a specificwaveform-audio format tag.acmFormatTagEnum,MSACM32.DLL,AW,5, enumerates waveform-audio format tags availablefrom an ACM driver.acmGetVersion,MSACM32.DLL,NM,0, returns the version number of the ACM.acmMetrics,MSACM32.DLL,NM,3, returns various metrics for the ACM or related ACM objects.acmStreamClose,MSACM32.DLL,NM,2 closes an ACM conversion stream. If the function issuccessful, the handle is invalidated.acmStreamConvert,MSACM32.DLL,NM,3, requests the ACM to perform a conversion on thespecified conversion stream.acmStreamMessage,MSACM32.DLL,NM,4, sends a driver-specific message to an ACM driver.acmStreamOpen,MSACM32.DLL,NM,8, opens an ACM conversion stream.acmStreamPrepareHeader,MSACM32.DLL,NM,3, prepares an ACMSTREAMHEADERstructure for an ACM stream conversion.acmStreamReset,MSACM32.DLL,NM,2 stops conversions for a given ACM stream. All pendingbuffers are marked as done and returned to the application.acmStreamSize,MSACM32.DLL,NM,4, returns a recommended size for a source or destinationbuffer on an ACM stream.acmStreamUnprepareHeader,MSACM32.DLL,NM,3 cleans up the preparation performed bythe acmStreamPrepareHeader </native/sdk/win32/vfw/src/mmfu5dwy.htm> function for an ACMstream.AcquireCredentialsHandle,SECUR32.DLL,AW,9,Acquires a handle to preexisting credentials ofa security principal.AcsLan,DLCAPI.DLL,NM,2 communicates with IBM mainframes or networkperipheral devices,such as printers connected directly to thenetwork, by using the data link control (DLC) protocol.ActivateKeyboardLayout,USER32.DLL,NM,2 The ActivateKeyboardLayout function activates adifferent keyboard layout and sets the active keyboard layout for the entire system rather thanthe calling thread.AddAccessAllowedAce,ADVAPI32.DLL,NM,4, adds an access-allowed ACE to an ACL.AddAccessDeniedAce,ADVAPI32.DLL,NM,4, adds an access-denied ACE to an ACL.AddAce,ADVAPI32.DLL,NM,5, adds one or more ACEs to a specified ACL.AddAtom,KERNEL32.DLL,AW,1, adds a character string to the local atom table and returns aunique value (an atom) identifying the string.AddAuditAccessAce,ADVAPI32.DLL,NM,6, adds a system-audit ACE to a system ACL.AddFontResource,GDI32.DLL,AW,1, adds the font resource from the specified file to theWindows font table.AddForm,WINMM.DLL,AW,3, adds a form to the list of available forms that can be selected forthe specified printer.AddJob,WINMM.DLL,AW,5 obtains a path string that specifies a file that you can use to store aspooled print job.AddMonitor,WINMM.DLL,AW,3 installs a local printer monitor and links the configuration, data,and monitor files.AddNtmsMediaType,NTMSAPI.DLL,NM,3, adds the specified media type to the specified libraryif there is not currently a relation in the library object. The function then creates the systemmedia pools if they do not exist.AddPort,WINMM.DLL,AW,3, adds the name of a port to the list of supported ports.AddPrinter,WINMM.DLL,AW,3 adds a printer to the list of supported printers for a specifiedserver.AddPrinterConnection,WINMM.DLL,AW,1, adds a connection to the specified printer for thecurrent user.AddPrinterDriver,WINMM.DLL,AW,3, installs a local or remote printer driver and links theconfiguration, data, and driver files.

AddPrintProcessor,WINMM.DLL,AW,5 installs a print processor on thespecified server andadds the print-processor name to an internallist of supported print processors.AddPrintProvidor,WINMM.DLL,AW,3, installs a local printer provider and links the configuration,data, and provider files.AdjustTokenGroups,ADVAPI32.DLL,NM,6, adjusts groups in the specified access token.AdjustTokenPrivileges,ADVAPI32.DLL,NM,6 enables or disables privileges in the specifiedaccess token.AdjustWindowRect,USER32.DLL,NM,3 calculates the required size of the window rectangle,based on the desired client-rectangle size.AdjustWindowRectEx,USER32.DLL,NM,4 calculates the required size of thewindow rectangle,based on the desired size of the clientrectangle.ADsBuildEnumerator,ACTIVEDS.DLL,NM,2 Builds an enumerator object for the specifiedActive Directory container object.ADsBuildVarArrayInt,ACTIVEDS.DLL,NM,3 Builds a VARIANT array from an array ofDWORDS.ADsBuildVarArrayStr,ACTIVEDS.DLL,NM,3 Builds a VARIANT array from an array of Unicodestrings.ADsEnumerateNext,ACTIVEDS.DLL,NM,4 Populates a VARIANT arrray with elements fetchedfrom the indicated enumerator object.ADsFreeEnumerator,ACTIVEDS.DLL,NM,1 Frees an enumerator object previously createdthrough ADsBuildEnumeratorADsGetLastError,ACTIVEDS.DLL,NM,5 Retrieves the calling thread?s last-error code value.ADsGetObject,ACTIVEDS.DLL,NM,3 In Active Directory, bind to an object given its path andprimaryinterface identifier (IID).ADsOpenObject,ACTIVEDS.DLL,NM,6 In Active Directory, bind to an object using usernameand passwordcredentials.ADsSetLastError,ACTIVEDS.DLL,NM,3 Sets the calling thread?s last-error code value.AdvancedDocumentProperties,WINMM.DLL,AW,5 displays a printerconfiguration dialog box forthe specified printer, allowing theuser to configure that printer.AllocateAndInitializeSid,ADVAPI32.DLL,NM,11, allocates and initializes a security identifier(SID) with up to eight subauthorities.AllocateLocallyUniqueId,ADVAPI32.DLL,NM,1, allocates a locally unique identifier (LUID).AllocateNtmsMedia,NTMSAPI.DLL,NM,6, allocates a piece of available media.AllocConsole,KERNEL32.DLL,NM,0, allocates a new console for the calling process.AngleArc,GDI32.DLL,NM,6, moves the current position to the ending point of the arc.AnimatePalette,GDI32.DLL,NM,4 replaces entries in the specified logical palette.AnimateWindow,USER32.DLL,NM,3, enables you to produce special effects when showing orhiding windows.AnyPopup,USER32.DLL,NM,0, indicates whether an owned, visible, top- level pop-up, oroverlapped window exists on the screen.AppendMenu,USER32.DLL,AW,4, appends a new item to the end of the specified menu bar,drop-down menu, submenu, or shortcut menu.ApplyControlToken,SECUR32.DLL,NM,2,Provides a way to apply a control token to a securitycontext.Arc,GDI32.DLL,NM,9, draws an elliptical arc.ArcTo,GDI32.DLL,NM,9, draws an elliptical arc.AreAllAccessesGranted,ADVAPI32.DLL,NM,2, checks whether a set of requested access rightshas been granted.AreAnyAccessesGranted,ADVAPI32.DLL,NM,2, tests whether any of a set of requested accessrights has been granted.AreFileApisANSI,KERNEL32.DLL,NM,0, determines whether a set of Win32 file functions isusing the ANSI or OEM character set code page.ArrangeIconicWindows,USER32.DLL,NM,1, arranges all the minimized (iconic) child windowsof the specified parent window.AssociateColorProfileWithDevice,MSCMS.DLL,AW,3, associates a specified color profile with aspecified device.AttachThreadInput,USER32.DLL,NM,3, fails if either of the specified threads does not have amessage queue.auxGetDevCaps,WINMM.DLL,AW,3, retrieves the capabilities of a given auxiliary outputdevice.auxGetNumDevs,WINMM.DLL,NM,0, retrieves the number of auxiliary output devices presentin the system.auxGetVolume,WINMM.DLL,NM,2, retrieves the current volume setting of the specifiedauxiliary output device.auxOutMessage,WINMM.DLL,NM,4, sends a message to the given auxiliary output device.auxSetVolume,WINMM.DLL,NM,2, sets the volume of the specified auxiliary output device.BackupEventLog,ADVAPI32.DLL,AW,2, saves the specified event log to a backup file.BackupFree,EDBBCLI.DLL,NM,1, frees a backup memory buffer.BackupRead,KERNEL32.DLL,NM,7, reads data associated with a specified file or directory intoa buffer.BackupSeek,KERNEL32.DLL,NM,6, seeks forward in a data stream initially accessed by usingthe BackupRead or BackupWrite function.BackupWrite,KERNEL32.DLL,NM,7, writes a stream of data from a buffer to a specified file ordirectory.BatchExport,DAPI.DLL,AW,1, exports objects from the Microsoft Exchange Server directory.BatchImport,DAPI.DLL,AW,1, imports directory service objects from a text file in a singlefunction call.Beep,KERNEL32.DLL,NM,2, generates simple tones on the speaker.BeginDeferWindowPos,USER32.DLL,NM,1 allocates memory for a multiple-window - positionstructure and returns the handle to thestructure.BeginPaint,USER32.DLL,NM,2 prepares the specified window for paintingand fills aPAINTSTRUCT structure with information about thepainting.BeginPath,GDI32.DLL,NM,1, opens a path bracket in the specified device context.BeginUpdateResource,KERNEL32.DLL,AW,2 returns a handle that can be usedby theUpdateResource function to add, delete, or replace resourcesin an executable file.bind,WS2_32.DLL,NM,3, is used on an unconnected socket before subsequent calls to theconnect or listen functions.bind,WSOCK32.DLL,NM,3, is used on an unconnected socket before subsequent calls to theconnect or listen functions.BindImage,IMAGEHLP.DLL,NM,3, computes the virtual address of each imported function.BindImageEx,IMAGEHLP.DLL,NM,5, computes the virtual address of each function that isimported.BindMoniker,OLE32.DLL,NM,4,This function locates an object by means of its moniker,activates the object if it is inactive, and retrieves a pointer to the specified interface on thatobject.BitBlt,GDI32.DLL,NM,9 performs a bit-block transfer of the color datacorresponding to arectangle of pixels from the specified sourcedevice context into a destination device context.BringWindowToTop,USER32.DLL,NM,1, brings the specified window to the top of the Z order.BroadcastSystemMessage,USER32.DLL,AW,5, sends a message to the specified recipients.BstrFromVector,OLEAUT32.DLL,NM,2,Returns a BSTR, assigning each element of the vectorto a character in the BSTR.BuildCommDCB,KERNEL32.DLL,AW,2, fills a specified DCB structure with values specified ina device-control string.BuildCommDCBAndTimeouts,KERNEL32.DLL,AW,3 translates a device-definitionstring intoappropriate device-control block codes and then placesthese codes into a device control block.BuildDisplayTable,MAPI32.DLL,NM,10, creates a display table from the property page datacontained in one or more DTPAGE structures.

Page 122: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

122BuildExplicitAccessWithName,ADVAPI32.DLL,AW,5, initializes an EXPLICIT_ACCESSstructure with data specified by the caller.BuildImpersonateExplicitAccessWithName,ADVAPI32.DLL,AW,6, is provided for future use.BuildImpersonateTrustee,ADVAPI32.DLL,AW,2, is provided for future use.BuildSecurityDescriptor,ADVAPI32.DLL,AW,9, allocates and initializes a new securitydescriptor.BuildTrusteeWithName,ADVAPI32.DLL,AW,2, initializes a TRUSTEE structure.BuildTrusteeWithSid,ADVAPI32.DLL,AW,2, initializes a TRUSTEE structure.CallMsgFilter,USER32.DLL,AW,2 passes the specified message and hookcode to the hookprocedures associated with the WH_SYSMSGFILTER andWH_MSGFILTER hooks.CallNamedPipe,KERNEL32.DLL,AW,7 connects to a message-type pipe (and waits if aninstance of the pipe is not available), writes to and reads from the pipe, and then closes thepipe.CallNextHookEx,USER32.DLL,NM,4, passes the hook information to the next hook procedurein the current hook chain.CallWindowProc,USER32.DLL,AW,5, passes message information to the specified windowprocedure.CancelDC,GDI32.DLL,NM,1, cancels any pending operation on the specified device context(DC).CancelIo,KERNEL32.DLL,NM,1 cancels all pending input and output (I/O)operations that wereissued by the calling thread for the specifiedfile handle.CancelNtmsLibraryRequest,NTMSAPI.DLL,NM,2, cancels outstanding RSM requests, such ascalls to the CleanNtmsDrive function. If the library is busy, RSM queues the cancellation andreturns success.CancelNtmsOperatorRequest,NTMSAPI.DLL,NM,2, cancels the specified RSM operatorrequest.CancelWaitableTimer,KERNEL32.DLL,NM,1, sets the specified ?waitable? timer to the inactivestate.CascadeWindows,USER32.DLL,NM,5, cascades the specified windows or the child windows ofthe specified parent window.CertAddCertificateContextToStore,CRYPT32.DLL,NM,4, adds a certificate context to thecertificate store.CertAddCRLContextToStore,CRYPT32.DLL,NM,4, adds a certificate revocation list (CRL)context to the certificate store.CertAddCTLContextToStore,CRYPT32.DLL,NM,4, adds a certificate trust list (CTL) context to acertificate store.CertAddEncodedCertificateToStore,CRYPT32.DLL,NM,6, creates a certificate context from anencoded certificate and adds it to the certificate store.CertAddEncodedCRLToStore,CRYPT32.DLL,NM,6, creates a certificate revocation list (CRL)context from an encoded CRL and adds it to the certificate store. The function makes a copy ofthe CRL context before adding it to the store.CertAddEncodedCTLToStore,CRYPT32.DLL,NM,6, creates a certificate trust list (CTL) contextfrom an encoded CTL and adds it to the certificate store. The function makes a copy of the CTLcontext before adding it to the store.CertAddEnhancedKeyUsageIdentifier,CRYPT32.DLL,NM,2, adds a usage identifier objectidentifier (OID) to the enhanced key usage (EKU) extended property of the certificate.CertAddSerializedElementToStore,CRYPT32.DLL,NM,8,Adds a serialized certificate, certificaterevocation list (CRL), or certificate trust list (CTL) element to the store.CertAlgIdToOID,CRYPT32.DLL,NM,1,Converts a CryptoAPI algorithm identifier (ALG_ID) to anAbstract Syntax Notation One (ASN.1) object identifier (OID) string.CertCloseStore,CRYPT32.DLL,NM,2, closes a certificate store handle and reduces thereference count on the store. There needs to be a corresponding call to CertCloseStore foreach successful call to the CertOpenStore or CertDuplicateStore functions.CertCompareCertificate,CRYPT32.DLL,NM,3, compares two certificates to determine whetherthey are identical.CertCompareCertificateName,CRYPT32.DLL,NM,3, compares two certificateCERT_NAME_BLOB structures to determine whether they are identical. TheCERT_NAME_BLOB structures are used for the subject and the issuer of certificates.CertCompareIntegerBlob,CRYPT32.DLL,NM,2, compares two integer BLOBs to determinewhether they represent equal numeric values.CertComparePublicKeyInfo,CRYPT32.DLL,NM,3, compares two encoded public keys todetermine whether they are identical.CertCreateCertificateContext,CRYPT32.DLL,NM,3, creates a certificate context from anencoded certificate. The created context is not persisted to a certificate store. The functionmakes a copy of the encoded certificate within the created context.CertCreateCRLContext,CRYPT32.DLL,NM,3, creates a certificate revocation list (CRL) contextfrom an encoded CRL. The created context is not persisted to a certificate store. It makes acopy of the encoded CRL within the created context.CertCreateCTLContext,CRYPT32.DLL,NM,3, creates a certificate trust list (CTL) context froman encoded CTL. The created context is not persisted to a certificate store. The function makesa copy of the encoded CTL within the created context.CertDeleteCertificateFromStore,CRYPT32.DLL,NM,1, deletes the specified certificate contextfrom the certificate store.CertDeleteCRLFromStore,CRYPT32.DLL,NM,1, deletes the specified certificate revocation list(CRL) context from the certificate store.CertDeleteCTLFromStore,CRYPT32.DLL,NM,1, deletes the specified certificate trust list (CTL)context from a certificate store.CertDuplicateCertificateContext,CRYPT32.DLL,NM,1,Duplicates a certificate context byincrementing its reference count.CertDuplicateCRLContext,CRYPT32.DLL,NM,1, duplicates a certificate revocation list (CRL)context by incrementing its reference count.CertDuplicateCTLContext,CRYPT32.DLL,NM,1, duplicates a certificate trust list (CTL) contextby incrementing its reference count.CertDuplicateStore,CRYPT32.DLL,NM,1,Duplicates a store handle by incrementing the store'sreference count.CertEnumCertificateContextProperties,CRYPT32.DLL,NM,2, retrieves the first or next extendedproperty associated with a certificate context.CertEnumCertificatesInStore,CRYPT32.DLL,NM,2,Retrieves the first or next certificate in acertificate store. Used in a loop, this function can retrieve in sequence all certificates in acertificate store.CertEnumCRLContextProperties,CRYPT32.DLL,NM,2, retrieves the first or next extendedproperty associated with a certificate revocation list (CRL) context.CertEnumCTLContextProperties,CRYPT32.DLL,NM,2, retrieves the first or next extendedproperty associated with a certificate trust list (CTL) context. Used in a loop, this function canretrieve in sequence all extended properties associated with a CTL context.CertEnumCTLsInStore,CRYPT32.DLL,NM,2, retrieves the first or next certificate trust list (CTL)context in a certificate store. Used in a loop, this function can retrieve in sequence all CTLcontexts in a certificate store.CertFindAttribute,CRYPT32.DLL,NM,3, finds the first attribute in the CRYPT_ATTRIBUTEarray, as identified by its object identifier (OID).CertFindCertificateInStore,CRYPT32.DLL,NM,6,Finds the first or next certificate context in acertificate store that matches a search criteria established by the dwFindType and itsassociated pvFindPara.CertFindCTLInStore,CRYPT32.DLL,NM,6, finds the first or next certificate trust list (CTL)context that matches search criteria established by the dwFindType and its associatedpvFindPara.CertFindExtension,CRYPT32.DLL,NM,3, finds the first extension in the CERT_EXTENSIONarray, as identified by its object identifier (OID).

CertFindRDNAttr,CRYPT32.DLL,NM,2, finds the first RDN attribute identified by its objectidentifier (OID) in a list of the Relative Distinguished Names (RDN).CertFindSubjectInCTL,CRYPT32.DLL,NM,5, attempts to find the specified subject in acertificate trust list (CTL).CertFreeCertificateContext,CRYPT32.DLL,NM,1,Frees a certificate context by decrementing itsreference count. When the reference count goes to zero, CertFreeCertificateContext frees thememory occupied by a certificate context.CertFreeCRLContext,CRYPT32.DLL,NM,1, frees a certificate revocation list (CRL) context bydecrementing its reference count. When the reference count goes to zero, CertFreeCRLContextfrees the memory occupied by a CRL context.CertFreeCTLContext,CRYPT32.DLL,NM,1, frees a certificate trust list (CTL) context bydecrementing its reference count. When the reference count goes to zero, CertFreeCTLContextfrees the memory occupied by a CTL context.CertGetCertificateContextProperty,CRYPT32.DLL,NM,4, retrieves the information contained inan extended property of a certificate context.CertGetCRLContextProperty,CRYPT32.DLL,NM,4, gets an extended property for the specifiedcertificate revocation list (CRL) context.CertGetCRLFromStore,CRYPT32.DLL,NM,4,Gets the first or next certificate revocation list(CRL) context from the certificate store for the specified issuer.CertGetCTLContextProperty,CRYPT32.DLL,NM,4, retrieves an extended property of acertificate trust list (CTL) context.CertGetEnhancedKeyUsage,CRYPT32.DLL,NM,4, returns information from the enhanced keyusage (EKU) extension or the EKU extended property of a certificate. EKUs indicate valid usesof the certificate.CertGetIntendedKeyUsage,CRYPT32.DLL,NM,4, acquires the intended key usage bytes from acertificate. The intended key usage can be in either the szOID_KEY_USAGE (CertGetIssuerCertificateFromStore,CRYPT32.DLL,NM,4,Retrieves the certificate context fromthe certificate store for the first or next issuer of the specified subject certificate. The newCertificate Chain Verification Functions are recommended instead of the use of this function.CertGetSubjectCertificateFromStore,CRYPT32.DLL,NM,3,Returns from a certificate store asubject certificate context uniquely identified by its issuer and serial number.CertIsRDNAttrsInCertificateName,CRYPT32.DLL,NM,4, compares the attributes in thecertificate name with the specified CERT_RDN to determine whether all attributes are includedthere.CertNameToStr,CRYPT32.DLL,AW,5,Converts an encoded name in a CERT_NAME_BLOBstructure to a null-terminated character string.CertOIDToAlgId,CRYPT32.DLL,NM,1, converts the Abstract Syntax Notation One (ASN.1)object identifier (OID) string to the CryptoAPI algorithm identifier (ALG_ID).CertOpenStore,CRYPT32.DLL,NM,5,Opens a certificate store using a specified store providertype.CertOpenSystemStore,CRYPT32.DLL,AW,2, is a simplified function used to open the mostcommon system certificate store. To open certificate stores with more complex requirements,such as file-based or memory-based stores, use CertOpenStore.CertRDNValueToStr,CRYPT32.DLL,AW,4, converts a name in a CERT_RDN_VALUE_BLOBto a null-terminated character string.CertRemoveEnhancedKeyUsageIdentifier,CRYPT32.DLL,NM,2, removes a usage identifierobject identifier (OID) from the enhanced key usage (EKU) extended property of the certificate.CertSaveStore,CRYPT32.DLL,NM,6,Saves the certificate store to a file or to a memory BLOB.CertSerializeCertificateStoreElement,CRYPT32.DLL,NM,4, serializes a certificate context'sencoded certificate and its encoded properties. The result can be persisted to storage so thatthe certificate and properties can be retrieved at a later time.CertSerializeCRLStoreElement,CRYPT32.DLL,NM,4, serializes an encoded certificaterevocation list (CRL) context and the encoded representation of its properties.CertSerializeCTLStoreElement,CRYPT32.DLL,NM,4, serializes an encoded certificate trust list(CTL) context and the encoded representation of its properties. The result can be persisted tostorage so that the CTL and properties can be retrieved later.CertSetCertificateContextProperty,CRYPT32.DLL,NM,4, sets an extended property for aspecified certificate context.CertSetCRLContextProperty,CRYPT32.DLL,NM,4, sets an extended property for the specifiedcertificate revocation list (CRL) context.CertSetCTLContextProperty,CRYPT32.DLL,NM,4, sets an extended property for the specifiedcertificate trust list (CTL) context.CertSetEnhancedKeyUsage,CRYPT32.DLL,NM,2, sets the enhanced key usage (EKU)property for the certificate.CertStrToName,CRYPT32.DLL,AW,7,Converts a null-terminated X.500 string to an encodedcertificate name.CertVerifyCRLRevocation,CRYPT32.DLL,NM,4, check a CRL to determine whether a subject'scertificate has or has not been revoked. The new Certificate Chain Verification Functions arerecommended instead of the use of this function.CertVerifyCRLTimeValidity,CRYPT32.DLL,NM,2, verifies the time validity of a CRL.CertVerifyCTLUsage,CRYPT32.DLL,NM,7, verifies that a subject is trusted for a specifiedusage by finding a signed and time-valid CTL with the usage identifiers that contain the subject.CertVerifyRevocation,CRYPT32.DLL,NM,7,Checks the revocation status of the certificatescontained in the rgpvContext array. If a certificate in the list is found to be revoked, no furtherchecking is done.CertVerifySubjectCertificateContext,CRYPT32.DLL,NM,3, performs the enabled verificationchecks on a certificate by checking the validity of the certificate's issuer. The new CertificateChain Verification Functions are recommended instead this function.CertVerifyTimeValidity,CRYPT32.DLL,NM,2, verifies the time validity of a certificate.CertVerifyValidityNesting,CRYPT32.DLL,NM,2, verifies that a subject certificate's time validitynests correctly within its issuer's time validity.ChangeClipboardChain,USER32.DLL,NM,2, removes a specified window from the chain ofclipboard viewers.ChangeDisplaySettings,USER32.DLL,AW,2, changes the display settings to the specifiedgraphics mode.ChangeIdleRoutine,MAPI32.DLL,NM,7, changes some or all of the characteristics of a FNIDLE- based idle routine.ChangeNtmsMediaType,NTMSAPI.DLL,NM,3, moves the specified PMID to the specified targetmedia pool and sets the PMID's media type identifier to the media type of the target media pool.ChangeServiceConfig,ADVAPI32.DLL,AW,11, changes the configuration parameters of aservice.CharLower,USER32.DLL,AW,1, converts a character string or a single character to lowercase.CharLowerBuff,USER32.DLL,AW,2, converts uppercase characters in a buffer to lowercasecharacters.CharNext,USER32.DLL,AW,1 returns a pointer to the next character in a string.CharNextEx,USER32.DLL,AW,3 The CharNextExA function retrieves the pointer to the nextcharacter in a string.CharPrev,USER32.DLL,AW,2, returns a pointer to the preceding character in a string.CharPrevEx,USER32.DLL,AW,4 retrieves the pointer to the preceding character in a string.CharToOem,USER32.DLL,AW,2, translates a string into the OEM-defined character set.CharToOemBuff,USER32.DLL,AW,3, translates a specified number of characters in a stringinto the OEM-defined character set.CharUpper,USER32.DLL,AW,1, converts a character string or a single character to uppercase.CharUpperBuff,USER32.DLL,AW,2, converts lowercase characters in a buffer to uppercasecharacters.CheckBitmapBits,MSCMS.DLL,NM,9, checks whether the pixels in a specified bitmap lie withinthe output gamut of a specified transform.CheckColors,MSCMS.DLL,NM,5, determines whether the colors in an array lie within the outputgamut of a specified transform.

Page 123: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

123CheckDlgButton,USER32.DLL,NM,3, changes the check state of a button control.CheckMenuItem,USER32.DLL,NM,3, sets the state of the specified menu item's check markattribute to either checked or unchecked.CheckMenuRadioItem,USER32.DLL,NM,5, checks a specified menu item and makes it a radioitem.CheckRadioButton,USER32.DLL,NM,4 adds a check mark to (checks) aspecified radio buttonin a group and removes a check mark from(clears) all other radio buttons in the group.CheckSumMappedFile,IMAGEHLP.DLL,NM,5, computes the checksum of the specified imagefile.ChildWindowFromPoint,USER32.DLL,NM,3, determines which, if any, of the child windowsbelonging to a parent window contains the specified point.ChildWindowFromPointEx,USER32.DLL,NM,4 determines which, if any, of the child windowsbelonging to the specified parent window contains the specified point.ChooseColor,COMDLG32.DLL,AW,1, creates a Color common dialog box that enables the userto select a color.ChooseFont,COMDLG32.DLL,AW,1, creates a Font common dialog box that enables the userto choose attributes for a logical font.ChoosePixelFormat,GDI32.DLL,NM,2 compares the generic pixel formats supported byWindows NT and any device pixel formats supported by special hardware accelerators with thepixel format you described, and returns the best match.Chord,GDI32.DLL,NM,9, draws a chord (a region bounded by the intersection of an ellipse anda line segment, called a ?secant?).CleanNtmsDrive,NTMSAPI.DLL,NM,2, queues a cleaning request for the specified drive forcleaning.ClearCommBreak,KERNEL32.DLL,NM,1 restores character transmission for aspecifiedcommunications device and places the transmission line ina nonbreak state.ClearCommError,KERNEL32.DLL,NM,3 retrieves information about acommunications error andreports the current status of acommunications device.ClearEventLog,ADVAPI32.DLL,AW,2, clears the specified event log, and optionally saves thecurrent copy of the logfile to a backup file.ClientToScreen,USER32.DLL,NM,2, replaces the client coordinates in the POINT structure withthe screen coordinates.ClipCursor,USER32.DLL,NM,1, confines the cursor to a rectangular area on the screen.CloseClipboard,USER32.DLL,NM,0, closes the clipboard.CloseColorProfile,MSCMS.DLL,NM,1,This CloseColorProfile closes an open profile handle.CloseDesktop,USER32.DLL,NM,1, closes an open handle to a desktop object.CloseEnhMetaFile,GDI32.DLL,NM,1 closes an enhanced-metafile devicecontext and returns ahandle that identifies an enhanced-formatmetafile.CloseEventLog,ADVAPI32.DLL,NM,1, closes the specified event log.CloseFigure,GDI32.DLL,NM,1, closes an open figure in a path.CloseHandle,KERNEL32.DLL,NM,1, closes an open object handle.CloseIMsgSession,MAPI32.DLL,NM,1, closes a message session and all the messagescreated within that session.CloseMetaFile,GDI32.DLL,NM,1, closes a metafile device context and returns a handle thatidentifies a Windows-format metafile.CloseNtmsNotification,NTMSAPI.DLL,NM,1, closes the specified open notification channel.CloseNtmsSession,NTMSAPI.DLL,NM,1, closes the specified RSM session.ClosePrinter,WINMM.DLL,NM,1, closes the specified printer object.CloseServiceHandle,ADVAPI32.DLL,NM,1 closes the handles created with OpenSCManager,OpenService or CreateServiceclosesocket,WS2_32.DLL,NM,1, closes a socket.closesocket,WSOCK32.DLL,NM,1, closes a socket.CloseWindow,USER32.DLL,NM,1, minimizes (but does not destroy) the specified window.CloseWindowStation,USER32.DLL,NM,1, closes an open window station handle.CLSIDFromProgID,OLE32.DLL,NM,2,Looks up a CLSID in the registry, given a ProgID.CLSIDFromString,OLE32.DLL,NM,2,Converts a string generated by the StringFromCLSIDfunction back into the original CLSID.ClusWorkerCheckTerminate,RESUTILS.DLL,NM,1,The ClusWorkerCheckTerminate utilityfunction determines whether a worker thread should exit as soon as possible.ClusWorkerCreate,RESUTILS.DLL,NM,3,The ClusWorkerCreate utility function creates aworker thread.ClusWorkerTerminate,RESUTILS.DLL,NM,1,The ClusWorkerTerminate utility functionterminates a worker thread.CoAddRefServerProcess,OLE32.DLL,NM,0,Increments a global per-process reference count.CoBuildVersion,OLE32.DLL,NM,0,4.2 CoBuildVersion This function is obsolete.Requirements OS Versions: Windows CE 3.0 and later. Header: Objbase.h. Link Library:Ole32.lib.CoCopyProxy,OLE32.DLL,NM,2,This function makes a private copy of the specified proxy.CoCreateFreeThreadedMarshaler,OLE32.DLL,NM,2,Creates an aggregatable object capable ofcontext-dependent marshaling.CoCreateGuid,OLE32.DLL,NM,1,Creates a GUID, a unique 128-bit integer used for CLSIDsand interface identifiers.CoCreateInstance,OLE32.DLL,NM,5,ExCreates an instance of a specific class on a specificmachine.CoCreateInstanceEx,OLE32.DLL,NM,6,Creates an instance of a specific class on a specificmachine.CoDisconnectObject,OLE32.DLL,NM,2,This function disconnects all remote processconnections being maintained on behalf of all the interface pointers that point to a specifiedobject. Only the process that actually manages the object should call CoDisconnectObject.CoDosDateTimeToFileTime,OLE32.DLL,NM,3,Converts the MS-DOS representation of thetime and date to a FILETIME structure, which Win32 uses to determine the date and time.CoFileTimeNow,OLE32.DLL,NM,1, Pointer to return the FILETIME structure.CoFileTimeToDosDateTime,OLE32.DLL,NM,3,Converts a FILETIME into MS-DOS date andtime values.CoFreeAllLibraries,OLE32.DLL,NM,0, This function frees all the DLLs that have been loadedwith the CoLoadLibrary function (called internally by CoGetClassObject), regardless of whetherthey are currently in use.CoFreeLibrary,OLE32.DLL,NM,1,This function frees a library that, when loaded, was specifiedto be freed explicitly.CoFreeUnusedLibraries,OLE32.DLL,NM,0,Unloads any DLLs that are no longer in use andthat, when loaded, were specified to be freed automatically.CoGetCallContext,OLE32.DLL,NM,2, Interface identifier (IID) of the call context that is beingrequested.CoGetCallerTID,OLE32.DLL,NM,1,Returns a GUID identifying the callers thread.CoGetClassObject,OLE32.DLL,NM,5,FromURL Returns a factory object for a given CLSID.CoGetClassObjectFromURL,URLMON.DLL,NM,10, Returns a factory object for a given CLSID.CoGetCurrentLogicalThreadId,OLE32.DLL,NM,1, This function is not yet supported.CoGetCurrentProcess,OLE32.DLL,NM,0, This function returns a value that is unique to thecurrent thread. CoGetCurrentProcess can be used to avoid thread ID reuse problems.DWORD CoGetCurrentProcess(void); Return Value Unique DWORD value identifying thecurrent thread.CoGetInstanceFromFile,OLE32.DLL,NM,8,This function creates a new object and initializes itfrom a file using IPersistFile::Load.CoGetInterfaceAndReleaseStream,OLE32.DLL,NM,3,This function unmarshals a buffercontaining an interface pointer and releases the stream when an interface pointer has beenmarshaled from another thread to the calling thread.CoGetMalloc,OLE32.DLL,NM,2,4.2 CoGetMalloc This function retrieves a pointer to thedefault OLE task memory allocator (which supports the system implementation of the IMalloc

CoGetMarshalSizeMax,OLE32.DLL,NM,6,4.2 CoGetMarshalSizeMax This function returnsan upper bound on the number of bytes needed to marshal the specified interface pointer to theCoGetObject,OLE32.DLL,NM,4, Converts a display name into a moniker that identifies theobject named, and then binds to the object identified by the moniker.CoGetPSClsid,OLE32.DLL,NM,2,This function returns the CLSID of the DLL that implementsthe proxy and stub for the specified interface.CoGetStandardMarshal,OLE32.DLL,NM,6,4.2 CoGetStandardMarshal This function createsa default, or standard, marshaling object in either the client process or the server process,CoGetState,OLE32.DLL,NM,1, This function is not yet supported.CoGetTIDFromIPID,OLE32.DLL,NM,1, This function is not yet supported.CoGetTreatAsClass,OLE32.DLL,NM,2,4.2 CoGetTreatAsClass This function returns theCLSID of an object that can emulate the specified object. HRESULT CoGetTreatAsClass(REFCLSIDCoImpersonateClient,OLE32.DLL,NM,0,Allows the server to impersonate the client of thecurrent call for the duration of the call.CoInitialize,OLE32.DLL,NM,1 Initializes the COM library on the current thread and identifies theconcurrency model as single-thread apartmentCoInitializeEx,OLE32.DLL,NM,2,Initializes the COM library for use by the calling thread, setsthe thread's concurrency model, and creates a new apartment for the thread if one is required.CoInitializeSecurity,OLE32.DLL,NM,9,Registers security and sets the default security values forthe process. This function is called exactly once per process, either explicitly or implicitly. It canbe called by the client, server, or both.CoIsHandlerConnected,OLE32.DLL,NM,1, This function determines whether a remote object isconnected to the corresponding in-process object.CoIsOle1Class,OLE32.DLL,NM,1,This function determines if a given CLSID represents an OLE1 object.CoLoadLibrary,OLE32.DLL,NM,2,Loads a specific DLL into the caller's process. CoLoadLibraryis equivalent to LoadLibraryEx. CoLoadLibrary does not do anything about the lifetime of thelibrary.CoLockObjectExternal,OLE32.DLL,NM,3,4.2 CoLockObjectExternal This function is calledeither to lock an object to ensure that it stays in memory, or to release such a lock. CallCoMarshalHresult,OLE32.DLL,NM,2,This function marshals an HRESULT to the specifiedstream, from which it can be unmarshaled using the CoUnmarshalHresult function.CoMarshalInterface,OLE32.DLL,NM,6, This function writes into a stream the data required toinitialize a proxy object in some client process. The COM library in the client process calls theCoUnmarshalInterface function to extract the data and initialize the proxy.CoMarshalInterThreadInterfaceInStream,OLE32.DLL,NM,3,Marshals an interface pointer fromone thread to another thread in the same process.CombineRgn,GDI32.DLL,NM,4 combines two regions and stores the result in a third region.CombineTransform,GDI32.DLL,NM,3, concatenates two world-space to page- spacetransformations.CommConfigDialog,KERNEL32.DLL,AW,3, displays a driver-supplied configuration dialog box.CommDlgExtendedError,COMDLG32.DLL,NM,0, can return general error codes for any of thecommon dialog box functions.CommitUrlCacheEntry,WININET.DLL,AW,11,Stores data in the specified file in the Internetcache and associates it with the specified URL.CompareFileTime,KERNEL32.DLL,NM,2, compares two 64-bit file times.CompareString,KERNEL32.DLL,AW,6 compares two character strings, usingthe localespecified by the given identifier as the basis for thecomparison.CompleteAuthToken,SECUR32.DLL,NM,2, completes an authentication token.ConfigurePort,WINMM.DLL,AW,3, displays the port-configuration dialog box for a port on thespecified server.connect,WS2_32.DLL,NM,3, establishes a connection to a specifed socket.connect,WSOCK32.DLL,NM,3, is used to create a connection to the to the specifieddestination.ConnectNamedPipe,KERNEL32.DLL,NM,2 enables a named pipe server process to wait for aclient process to connect to an instance of a named pipe.ConnectToPrinterDlg,WINMM.DLL,NM,2, displays a dialog box that lets users browse andconnect to printers on a network.ContinueDebugEvent,KERNEL32.DLL,NM,3 enables a debugger to continue a thread thatpreviously reported a debugging event.ControlService,ADVAPI32.DLL,NM,3, sends a control code to a Win32-based service.ConvertDefaultLocale,KERNEL32.DLL,NM,1, converts a special default locale value to anactual locale identifier.ConvertThreadToFiber,KERNEL32.DLL,NM,1 converts the current thread into a fiber.CopyAcceleratorTable,USER32.DLL,AW,3, copies the specified accelerator table.CopyEnhMetaFile,GDI32.DLL,AW,2, copies the contents of an enhanced- format metafile to aspecified file.CopyFile,KERNEL32.DLL,AW,3 copies an existing file to a new file.CopyFileEx,KERNEL32.DLL,AW,6, copies an existing file to a new file.CopyIcon,USER32.DLL,NM,1, copies the specified icon from another module to the currentmodule.CopyImage,USER32.DLL,NM,5 creates a new image (icon, cursor, orbitmap) and copies theattributes of the specified image to the newone.CopyLZFile,LZ32.DLL,NM,2, is obsolete.CopyMetaFile,GDI32.DLL,AW,2, copies the content of a Windows-format metafile to thespecified file.CopyRect,USER32.DLL,NM,2, copies the coordinates of one rectangle to another.CopySid,ADVAPI32.DLL,NM,3, copies a security identifier (SID) to a buffer.CoQueryAuthenticationServices,OLE32.DLL,NM,2,4.2 CoQueryAuthenticationServices Thisfunction retrieves a list of the authentication services registered when the process called .HRESULTCoQueryClientBlanket,OLE32.DLL,NM,7, This function is called by the server to find out aboutthe client that invoked the method executing on the current thread.CoQueryProxyBlanket,OLE32.DLL,NM,8,4.2 CoQueryProxyBlanket This function retrievesthe authentication information the client uses to make calls on the specified proxy. HRESULTCoQueryReleaseObject,OLE32.DLL,NM,1, This function is not yet supported.CoRegisterChannelHook,OLE32.DLL,NM,2, This function is not yet supported.CoRegisterClassObject,OLE32.DLL,NM,5,Registers an EXE class object with OLE so otherapplications can connect to it. EXE object applications should call CoRegisterClassObject onstartup.CoRegisterMallocSpy,OLE32.DLL,NM,1, This function registers an implementation of theIMallocSpy interface in OLE, thereafter requiring OLE to call its wrapper methods around everycall to the corresponding IMalloc method.CoRegisterMessageFilter,OLE32.DLL,NM,2,Registers with OLE the instance of anIMessageFilter interface, which is to be used for handling concurrency issues on the currentthread. Only one message filter can be registered for each thread.CoRegisterPSClsid,OLE32.DLL,NM,2,This function enables a downloaded DLL to register itscustom interfaces within its running process so that the marshaling code will be able to marshalthose interfaces.CoReleaseMarshalData,OLE32.DLL,NM,1,This function destroys a previously marshaled datapacket.CoReleaseServerProcess,OLE32.DLL,NM,0,Decrements the global per-process referencecount.CoResumeClassObjects,OLE32.DLL,NM,0,4.2 CoResumeClassObjects This function iscalled by a server that can register multiple class objects to inform the OLE SCM about allregisteredCoRevertToSelf,OLE32.DLL,NM,0,This function restores the authentication information on athread of execution.

Page 124: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

124CoRevokeClassObject,OLE32.DLL,NM,1, This function informs OLE that a class object,previously registered with the CoRegisterClassObject function, is no longer available for use.CoRevokeMallocSpy,OLE32.DLL,NM,0,This function revokes a registered IMallocSpy object.CoSetProxyBlanket,OLE32.DLL,NM,8,Sets the authentication information that will be used tomake calls on the specified proxy. This is a helper function for IClientSecurity::SetBlanket.CoSetState,OLE32.DLL,NM,1, This function is not yet supported.CoSuspendClassObjects,OLE32.DLL,NM,0,4.2 CoSuspendClassObjects This functionprevents any new activation requests from the SCM on all class objects registered within theprocess.CoSwitchCallContext,OLE32.DLL,NM,2, This function switches the call context object used byCoGetCallContext.CoTaskMemAlloc,OLE32.DLL,NM,1,Allocates a block of task memory in the same way thatIMalloc::Alloc does.CoTaskMemFree,OLE32.DLL,NM,1,Frees a block of task memory previously allocated througha call to the CoTaskMemAlloc or CoTaskMemRealloc function.CoTaskMemRealloc,OLE32.DLL,NM,2,Changes the size of a previously allocated block of taskmemory.CoTreatAsClass,OLE32.DLL,NM,2, This function establishes or removes an emulation, inwhich objects of one class are treated as objects of a different class.CoUninitialize,OLE32.DLL,NM,0,Closes the COM library on the current thread, unloads allDLLs loaded by the thread, frees any other resources that the thread maintains, and forces allRPC connections on the thread to close.CoUnmarshalHresult,OLE32.DLL,NM,2, Pointer to the stream from which the HRESULT is tobe unmarshaled.CoUnmarshalInterface,OLE32.DLL,NM,3,4.2 CoUnmarshalInterface This function initializes anewly created proxy using data written into the stream by a previous call to the function, andCountClipboardFormats,USER32.DLL,NM,0 retrieves the number of different data formatscurrently on the clipboard.CPlApplet,ODBCCP32.DLL,NM,4, is a library-defined callback function that serves as the entrypoint for a Control Panel application.CreateAcceleratorTable,USER32.DLL,AW,2, creates an accelerator table.CreateAntiMoniker,OLE32.DLL,NM,1, Address of IMoniker* pointer variable that receives theinterface pointer to the new anti-moniker.CreateAsyncBindCtx,URLMON.DLL,NM,4, Creates an asynchronous bind context for use withasynchronous monikers.CreateBindCtx,OLE32.DLL,NM,2,This function supplies a pointer to an implementation ofIBindCtx, an object that stores information about a particular moniker-binding operation.CreateBitmap,GDI32.DLL,NM,5, creates a bitmap with the specified width, height, and colorformat (color planes and bits per pixel).CreateBitmapIndirect,GDI32.DLL,NM,1 creates a bitmap with thespecified width, height, andcolor format (color planes and bitsper pixel).CreateBrushIndirect,GDI32.DLL,NM,1, creates a logical brush that has the specified style,color, and pattern.CreateCaret,USER32.DLL,NM,4, creates a new shape for the system caret and assignsownership of the caret to the specified window.CreateClassMoniker,OLE32.DLL,NM,2,Creates a class moniker that refers to the given class.CreateColorTransform,MSCMS.DLL,AW,4, creates a color transform that applications can useto perform color management.CreateCompatibleBitmap,GDI32.DLL,NM,3 creates a bitmap compatiblewith the device that isassociated with the specified devicecontext.CreateCompatibleDC,GDI32.DLL,NM,1, can only be used with devices that support rasteroperations.CreateConsoleScreenBuffer,KERNEL32.DLL,NM,5, creates a console screen buffer andreturns a handle of it.CreateCursor,USER32.DLL,NM,7 creates a cursor having the specified size, bit patterns, andhot spot.CreateDataAdviseHolder,OLE32.DLL,NM,1,Supplies a pointer to the OLE implementation ofIDataAdviseHolder on the data advise holder object.CreateDataCache,OLE32.DLL,NM,4,Supplies a pointer to a new instance of an OLE-providedimplementation of a data cache.CreateDC,GDI32.DLL,AW,4, creates a device context (DC) for a device by using the specifiedname.CreateDesktop,USER32.DLL,AW,6, returns a handle that can be used to access the desktop.CreateDeviceLinkProfile,MSCMS.DLL,NM,4, creates a device link profile from a set of colorprofiles, using the specified intents.CreateDialogIndirectParam,USER32.DLL,AW,5, creates a modeless dialog box from a dialogbox template in memory.CreateDialogParam,USER32.DLL,AW,5, creates a modeless dialog box from a dialog boxtemplate resource.CreateDIBitmap,GDI32.DLL,NM,6 creates a device-dependent bitmap (DDB)from a device-independent bitmap (DIB) and, optionally, sets thebitmap bits.CreateDIBPatternBrush,GDI32.DLL,NM,2 creates a logical brush that has the pattern specifiedby the specified device-independent bitmap (DIB).CreateDIBPatternBrushPt,GDI32.DLL,NM,2 creates a logical brush that has the patternspecified by the device-independent bitmap (DIB).CreateDIBSection,GDI32.DLL,NM,6, creates a device-independent bitmap (DIB) thatapplications can write to directly.CreateDirectory,KERNEL32.DLL,AW,2, creates a new directory.CreateDirectoryEx,KERNEL32.DLL,AW,3 creates a new directory with a specified path thatretains the attributes of a specified template directory.CreateDiscardableBitmap,GDI32.DLL,NM,3, creates a discardable bitmap that is compatiblewith the specified device.CreateDispTypeInfo,OLEAUT32.DLL,NM,3,Creates simplified type information for use in animplementation of IDispatch.CreateEllipticRgn,GDI32.DLL,NM,4, creates an elliptical region.CreateEllipticRgnIndirect,GDI32.DLL,NM,1, creates an elliptical region.CreateEnhMetaFile,GDI32.DLL,AW,4, creates a device context for an enhanced-formatmetafile.CreateEnvironmentBlock,USERENV.DLL,NM,3, retrieves the environment variables for thespecified user. This block can then be passed to the CreateProcessAsUser function.CreateErrorInfo,OLEAUT32.DLL,NM,1, This function creates an instance of a generic errorobject.CreateEvent,KERNEL32.DLL,AW,4, creates a named or unnamed event object.CreateFiber,KERNEL32.DLL,NM,3 allocates a fiber object, assigns it astack, and sets upexecution to begin at the specified startaddress, typically the fiber function.CreateFile,KERNEL32.DLL,AW,7, creates or opens file CreateFileMapping,KERNEL32.DLL,AW,6, creates a named or unnamed file- mapping objectfor the specified file.CreateFileMoniker,OLE32.DLL,NM,2,creates a file moniker based on the specified path.CreateFont,GDI32.DLL,AW,14, creates a logical font that has specific characteristics.CreateFontIndirect,GDI32.DLL,AW,1, creates a logical font that has the characteristicsspecified in the specified structure.CreateFormatEnumerator,URLMON.DLL,NM,3, Creates an object that implementsIEnumFORMATETC over a static array of FORMATETC structures.CreateGenericComposite,OLE32.DLL,NM,3,4.2 CreateGenericComposite This functionperforms a generic composition of two monikers and supplies a pointer to the resultingcomposite moniker.CreateHalftonePalette,GDI32.DLL,NM,1 creates a halftone palette for the specified devicecontext.

CreateHatchBrush,GDI32.DLL,NM,2, creates a logical brush that has the specified hatchpattern and color.CreateIC,GDI32.DLL,AW,4 creates an information context for the specified device.CreateIcon,USER32.DLL,NM,7, creates an icon that has the specified size, colors, and bitpatterns.CreateIconFromResource,USER32.DLL,NM,4, creates an icon or cursor from resource bitsdescribing the icon.CreateIconFromResourceEx,USER32.DLL,NM,7, creates an icon or cursor from resource bitsdescribing the icon.CreateIconIndirect,USER32.DLL,NM,1, creates an icon or cursor from an ICONINFO structure.CreateILockBytesOnHGlobal,OLE32.DLL,NM,3,Creates a byte array object, using globalmemory as the physical device, which is intended to be the compound file foundation.CreateIoCompletionPort,KERNEL32.DLL,NM,4 can associate an instance of an opened filewith a newly created or an existing input/output completion port; or it can create an input/outputcompletion port without associating it with a file.CreateIProp,MAPI32.DLL,NM,6, creates a property data object, that is, an IPropData object.CreateItemMoniker,OLE32.DLL,NM,3,This function creates an item moniker that identifies anobject within a containing object (typically a compound document).CreateMailslot,KERNEL32.DLL,AW,4 creates a mailslot with the specifiedname and returns ahandle that a mailslot server can use to performoperations on the mailslot.CreateMappedBitmap,COMCTL32.DLL,NM,5, creates a bitmap for use in a toolbar.CreateMDIWindow,USER32.DLL,AW,10, creates a multiple document interface (MDI) childwindow.CreateMenu,USER32.DLL,NM,0, creates a menu.CreateMetaFile,GDI32.DLL,AW,1, creates a device context for a Windows-meta file.CreateMultiProfileTransform,MSCMS.DLL,NM,6, accepts an array of profiles or a single devicelink profile and creates a color transform thatCreateMutex,KERNEL32.DLL,AW,3, creates a named or unnamed mutex object.CreateNamedPipe,KERNEL32.DLL,AW,8 creates an instance of a named pipe and returns ahandle for subsequent pipe operations.CreateNtmsMedia,NTMSAPI.DLL,AW,4,The CreateNtmsMediaPool function creates a newapplication media pool.CreateNtmsMediaPool,NTMSAPI.DLL,AW,6, creates a new application media pool.CreateOleAdviseHolder,OLE32.DLL,NM,1, instantiates an advise holder object for managingcompound document notifications. It passes out a pointer toCreatePalette,GDI32.DLL,NM,1, creates a logical color palette.CreatePatternBrush,GDI32.DLL,NM,1, creates a logical brush with the specified bitmap pattern.CreatePen,GDI32.DLL,NM,3, creates a logical pen that has the specified style, width, and color.CreatePenIndirect,GDI32.DLL,NM,1, creates a logical cosmetic pen that has the style, width,and color specified in a structure.CreatePipe,KERNEL32.DLL,NM,4, creates an anonymous pipe, and returns handles to theread and write ends of the pipe.CreatePointerMoniker,OLE32.DLL,NM,2, This function creates a pointer moniker based on apointer to an object.CreatePolygonRgn,GDI32.DLL,NM,3, creates a polygonal region.CreatePolyPolygonRgn,GDI32.DLL,NM,4, creates a region consisting of a series of polygons.CreatePopupMenu,USER32.DLL,NM,0, creates a drop-down menu, submenu, or shortcutmenu.CreatePrivateObjectSecurity,ADVAPI32.DLL,NM,6 allocates and initializesa self-relativesecurity descriptor for a new protected server?sis being created.CreateProcess,KERNEL32.DLL,AW,10, creates a new process and its primary thread.CreateProcessAsUser,ADVAPI32.DLL,AW,11, creates a new process and its primary thread.CreateProfileFromLogColorSpace,MSCMS.DLL,AW,2, converts a logical color space to aCreatePropertySheetPage,COMCTL32.DLL,AW,1, creates a new page for a property sheet.CreateRectRgn,GDI32.DLL,NM,4 creates a rectangular region.CreateRectRgnIndirect,GDI32.DLL,NM,1, creates a rectangular region.CreateRemoteThread,KERNEL32.DLL,NM,7, creates a thread that runs in the address spaceof another process.CreateRoundRectRgn,GDI32.DLL,NM,6, creates a rectangular region with rounded corners.CreateScalableFontResource,GDI32.DLL,AW,4, creates a font resource file for a scalable font.CreateSemaphore,KERNEL32.DLL,AW,4, creates a named or unnamed semaphore object.CreateService,ADVAPI32.DLL,AW,13, creates a service object and adds it to the specifiedservice control manager database.CreateSolidBrush,GDI32.DLL,NM,1, creates a logical brush that has the specified solid color.CreateStatusWindow,COMCTL32.DLL,AW,4, creates a status window, which is typically usedto display the status of an application.CreateStdDispatch,OLEAUT32.DLL,NM,4,Creates a standard implementation of the IDispatchinterface through a single function call. This simplifies exposing objects through Automation.CreateStreamOnHGlobal,OLE32.DLL,NM,3,Creates a stream object stored in global memory.CreateTable,MAPI32.DLL,NM,9 creates structures and an object handle for a table data objectan ITableData object which can be used to create table contents.CreateTapePartition,KERNEL32.DLL,NM,4 reformats a tape.CreateTextServices,RICHED20.DLL,NM,3,creates an instance of a text services object.CreateThread,KERNEL32.DLL,NM,6, creates a thread to execute within the address space ofthe calling process.CreateToolbarEx,COMCTL32.DLL,NM,13, creates a toolbar window and adds the specifiedbuttons to the toolbar.CreateToolhelp32Snapshot,TOOLHELP.DLL,NM,2, takes a snapshot of the specifiedprocesses in the system, as well as the heaps, modules, and threads used by these processes.CreateTypeLib,OLEAUT32.DLL,NM,3, creates a type library in the current file format.CreateTypeLib2,OLEAUT32.DLL,NM,3, creates a type library in the current file format.CreateUpDownControl,COMCTL32.DLL,NM,12, creates an up-down control.CreateUrlCacheEntry,WININET.DLL,AW,5,Creates a local file name for saving the cache entrybased on the specified URL and the file extension.CreateUrlCacheGroup,WININET.DLL,NM,2,Generates cache group identifications.CreateURLMoniker,URLMON.DLL,NM,3, Creates a URL moniker from either a full URL stringor from a base context URL moniker and a partial URL string.CreateUserProfile,USERENV.DLL,AW,5 creates a user profile with the specified account nameand preferred name.CreateWaitableTimer,KERNEL32.DLL,AW,3, creates a ?waitable? timer object.CreateWindow,USER32.DLL,AW,1 creates an overlapped, pop-up, or childwindowCreateWindowEx,USER32.DLL,AW,12 creates an overlapped, pop-up, or childwindow with anextended style; otherwise, this function isidentical to the CreateWindow function.CreateWindowStation,USER32.DLL,AW,4, creates a window station object.CryptAcquireContext,ADVAPI32.DLL,AW,5,used to acquire a handle to a particular keycontainer within a particular CSP.CryptCreateHash,ADVAPI32.DLL,NM,5,used to initiate the hashing of a stream of data. Itreturns to the caller a handle to a CSP hash object.CryptDecodeMessage,CRYPT32.DLL,NM,13,Decodes, decrypts, and verifies a cryptographicmessage.CryptDecodeObject,CRYPT32.DLL,NM,7, decodes a structure of the type indicated by thelpszStructType parameter. The use of CryptDecodeObjectEx is recommended as an API thatperforms the same function with significant performance improvements.CryptDecrypt,ADVAPI32.DLL,NM,6,The CryptDecryptAndVerifyMessageSignature functiondecrypts a message and verifies its signature.CryptDecryptAndVerifyMessageSignature,CRYPT32.DLL,NM,9, decrypts a message andverifies its signature.CryptDecryptMessage,CRYPT32.DLL,NM,6, decodes and decrypts a message.CryptDeriveKey,ADVAPI32.DLL,NM,5,generates cryptographic keys derived from base data.

Page 125: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

125CryptDestroyHash,ADVAPI32.DLL,NM,1,destroys the hash object referenced by the hHashparameter.CryptDestroyKey,ADVAPI32.DLL,NM,1,releases the handle referenced by the hKey parameter.CryptEncodeObject,CRYPT32.DLL,NM,5, encodes a structure of the type indicated by thevalue of the lpszStructType parameter. The use of CryptEncodeObjectEx is recommended asan API that performs the same function with significant performance improvements.CryptEncrypt,ADVAPI32.DLL,NM,7,is used to encrypt data.CryptEncryptMessage,CRYPT32.DLL,NM,7, encrypts and encodes a message.CryptEnumOIDFunction,CRYPT32.DLL,NM,6, enumerates the registered object identifier (OID)functions.CryptExportKey,ADVAPI32.DLL,NM,6,used to export cryptographic keys out of a cryptographicservice provider in a secure manner.CryptExportPublicKeyInfo,CRYPT32.DLL,NM,5, exports the public key information associatedwith the corresponding private key of the provider. For an updated version of this function, seeCryptExportPublicKeyInfoEx.CryptExportPublicKeyInfoEx,CRYPT32.DLL,NM,8, exports the public key informationassociated with the provider's corresponding private key.CryptFormatObject,CRYPT32.DLL,NM,9, formats the encoded data and returns a Unicodestring in the allocated buffer according to the certificate encoding type.CryptFreeOIDFunctionAddress,CRYPT32.DLL,NM,2, releases a handle returned byCryptGetOIDFunctionAddress or CryptGetDefaultOIDFunctionAddress by decrementing thereference count on the function handle.CryptGenKey,ADVAPI32.DLL,NM,4,generates random cryptographic keys for use with the CSPmodule.CryptGenRandom,ADVAPI32.DLL,NM,3,fills a buffer with random bytes.CryptGetDefaultOIDDllList,CRYPT32.DLL,NM,4, acquires the list of the names of DLL files thatcontain registered default object identifier (OID) functions for a specified function set andencoding type.CryptGetDefaultOIDFunctionAddress,CRYPT32.DLL,NM,6, loads the DLL that contains adefault function address.CryptGetHashParam,ADVAPI32.DLL,NM,5,retrieves data that governs the operations of a hashobject.CryptGetKeyParam,ADVAPI32.DLL,NM,5,retrieves data that govern the operations of a key.CryptGetMessageCertificates,CRYPT32.DLL,NM,5, returns the handle of an open certificatestore containing the message's certificates and CRLs. This function calls CertOpenStore usingprovider type CERT_STORE_PROV_PKCS7 as its lpszStoreProvider parameter.CryptGetMessageSignerCount,CRYPT32.DLL,NM,3, returns the number of signers of a signedmessage.CryptGetOIDFunctionAddress,CRYPT32.DLL,NM,6, searches the list of registered and installedfunctions for an encoding type and object identifier (OID) match.CryptGetOIDFunctionValue,CRYPT32.DLL,NM,7, queries a value associated with an OID.CryptGetProvParam,ADVAPI32.DLL,NM,5,retrieves parameters that govern the operations of aCSP.CryptGetUserKey,ADVAPI32.DLL,NM,3,retrieves a handle to a permanent user key pair, suchas the user?s signature key pair.CryptHashCertificate,CRYPT32.DLL,NM,7, hashes the entire encoded content of a certificateincluding its signature.CryptHashData,ADVAPI32.DLL,NM,4,used to compute the cryptographic hash on a stream ofdata.CryptHashMessage,CRYPT32.DLL,NM,9, creates a hash of the message.CryptHashPublicKeyInfo,CRYPT32.DLL,NM,7, encodes the public key information in aCERT_PUBLIC_KEY_INFO structure and computes the hash of the encoded bytes. The hashcreated is used with key identifier functions.CryptHashSessionKey,ADVAPI32.DLL,NM,3,used to compute the cryptographic hash on a keyobject.CryptHashToBeSigned,CRYPT32.DLL,NM,6, computes the hash of the encoded content from asigned and encoded certificate. The hash is performed on only theCryptImportKey,ADVAPI32.DLL,NM,6,is used to transfer a cryptographic key from a key blob tothe CSP.CryptImportPublicKeyInfo,CRYPT32.DLL,NM,4, converts and imports the public key informationinto the provider and returns a handle of the public key. CryptImportPublicKeyInfoEx provides arevised version of this function.CryptImportPublicKeyInfoEx,CRYPT32.DLL,NM,7, imports public key information into thecryptographic service provider (CSP) and returns a handle of the public key.CryptInitOIDFunctionSet,CRYPT32.DLL,NM,2,The CryptInitOIDFunctionSet initializes andreturns the handle of the OID function set identified by a supplied function set name.CryptInstallOIDFunctionAddress,CRYPT32.DLL,NM,6, installs a set of callable object identifier(OID) function addresses.CryptMsgCalculateEncodedLength,CRYPT32.DLL,NM,6, calculates the maximum number ofbytes need for an encoded cryptographic message given the message type, encodingparameters, and total length of the data to be encoded.CryptMsgClose,CRYPT32.DLL,NM,1, closes a cryptographic message handle. At each call tothis function, the reference count on the message is reduced by one. When the reference countreaches zero, the message is fully released.CryptMsgControl,CRYPT32.DLL,NM,4, performs a control operation after a message has beendecoded by a final call to the CryptMsgUpdate function.CryptMsgCountersign,CRYPT32.DLL,NM,4, countersigns an existing signature in a message.CryptMsgCountersignEncoded,CRYPT32.DLL,NM,7, countersigns an existing PKCS #7message signature.CryptMsgEncodeAndSignCTL,CRYPT32.DLL,NM,6, encodes a CTL and creates a signedmessage containing the encoded CTL.This function first encodes the CTL pointed to by pCtlInfoand then calls CryptMsgSignCTL to sign the encoded message.CryptMsgGetAndVerifySigner,CRYPT32.DLL,NM,6, verifies a cryptographic message'ssignature.CryptMsgGetParam,CRYPT32.DLL,NM,5, acquires a message parameter after a cryptographicmessage has been encoded or decoded. This function is called after the final CryptMsgUpdatecall.CryptMsgOpenToDecode,CRYPT32.DLL,NM,6,Opens a cryptographic message for decodingand returns a handle of the opened message.CryptMsgOpenToEncode,CRYPT32.DLL,NM,6, opens a cryptographic message for encodingand returns a handle of the opened message. The message remains open until CryptMsgCloseis called.CryptMsgSignCTL,CRYPT32.DLL,NM,7, creates a signed message containing an encodedCTL.CryptMsgUpdate,CRYPT32.DLL,NM,4, adds contents to a cryptographic message.CryptMsgVerifyCountersignatureEncoded,CRYPT32.DLL,NM,7, verifies the countersignature ofa message.CryptRegisterDefaultOIDFunction,CRYPT32.DLL,NM,4,The CryptRegisterDefaultOIDFunctionregisters a DLL containing the default function to be called for the specified encoding type andfunction name. Unlike CryptRegisterOIDFunction, the function name to be exported by the DLLcannot be overridden.CryptRegisterOIDFunction,CRYPT32.DLL,NM,5,Registers a DLL that contains the function tobe called for the specified encoding type, function name, and object identifier (OID).CryptReleaseContext,ADVAPI32.DLL,NM,2,is used to release a handle to a CSP and a keycontainer.CryptSetHashParam,ADVAPI32.DLL,NM,4,in theory, customizes the operations of a hashobject.CryptSetKeyParam,ADVAPI32.DLL,NM,4,customizes various aspects of a key?s operations.

CryptSetOIDFunctionValue,CRYPT32.DLL,NM,7, sets a value for the specified encoding type,function name, OID, and value name.CryptSetProvider,ADVAPI32.DLL,AW,2,is used to specify the current user default CSP.CryptSetProvParam,ADVAPI32.DLL,NM,4,customizes the operations of a CSP.CryptSignAndEncodeCertificate,CRYPT32.DLL,NM,9,Security SDK content provides detailsabout using authentication, authorization, cryptography, and related technologies in theMicrosoft Windows Server, Windows, and Windows NT platforms.CryptSignAndEncryptMessage,CRYPT32.DLL,NM,8, creates a hash of the specified content,signs the hash, encrypts the content, hashes the encrypted contents and the signed hash, andthen encodes both the encrypted content and the signed hash.CryptSignCertificate,CRYPT32.DLL,NM,9, signs theCryptSignHash,ADVAPI32.DLL,AW,6,is used to sign a piece of data.CryptSignMessage,CRYPT32.DLL,NM,7, creates a hash of the specified content, signs thehash, and then encodes both the original message content and the signed hash.CryptUnregisterDefaultOIDFunction,CRYPT32.DLL,NM,3, removes the registration of a DLLcontaining the default function to be called for the specified encoding type and function name.CryptUnregisterOIDFunction,CRYPT32.DLL,NM,3, removes the registration of a DLL containingthe function to be called for the specified encoding type, function name, and OID.CryptVerifyCertificateSignature,CRYPT32.DLL,NM,5,Verifies the signature of a certificate,certificate revocation list (CRL), or certificate request by using the public key in aCERT_PUBLIC_KEY_INFO structure.CryptVerifyDetachedMessageHash,CRYPT32.DLL,NM,8, verifies a detached hash.CryptVerifyDetachedMessageSignature,CRYPT32.DLL,NM,8, verifies a signed messagecontaining a detached signature or signatures.CryptVerifyMessageHash,CRYPT32.DLL,NM,7, verifies the hash of specified content.CryptVerifyMessageSignature,CRYPT32.DLL,NM,7,Verifies a signed message's signature.CryptVerifySignature,ADVAPI32.DLL,AW,6,is used to verify a signature against a hash object.DAPIAllocBuffer,DAPI.DLL,NM,2, allocates or reallocates a block of memory.DAPIEnd,DAPI.DLL,NM,1, closes a directory operation session.DAPIFreeMemory,DAPI.DLL,NM,1, releases or frees a block of memory.DAPIGetSiteInfo,DAPI.DLL,AW,3, retrieves the site information for a directory service agent.DAPIRead,DAPI.DLL,AW,6, reads (exports) attributes from a directory object.DAPIStart,DAPI.DLL,AW,2, initializes a directory operation session.DAPIUninitialize,DAPI.DLL,NM,1, terminates background processes.DAPIWrite,DAPI.DLL,AW,7, writes (imports) information to a directory object.DceErrorInqText,RPCRT4.DLL,AW,2, returns the message text for a status code.DdeAbandonTransaction,USER32.DLL,NM,3 abandons the specifiedasynchronous transactionand releases all resources associated withthe transaction.DdeAccessData,USER32.DLL,NM,2, provides access to the data in the specified dynamic dataexchange (DDE) object.DdeAddData,USER32.DLL,NM,4, adds data to the specified dynamic data exchange (DDE)object.DdeClientTransaction,USER32.DLL,NM,8, begins a data transaction between a client and aserver.DdeCmpStringHandles,USER32.DLL,NM,2, compares the values of two string handles.DdeConnect,USER32.DLL,NM,4 establishes a conversation with a server application thatsupports the specified service name and topic name pair.DdeCreateStringHandle,USER32.DLL,AW,3 creates a handle that identifies the string pointedto by the psz parameter.DdeConnectList,USER32.DLL,NM,5 establishes a conversation with allserver applications thatsupport the specified service name andtopic name pair.DdeCreateDataHandle,USER32.DLL,NM,7 creates a dynamic data exchange(DDE) object andfills the object with data from the specifiedbuffer.DdeDisconnect,USER32.DLL,NM,1 terminates a conversation started byeither the DdeConnector DdeConnectList function and invalidatesthe specified conversation handle.DdeDisconnectList,USER32.DLL,NM,1, destroys the specified conversation list and terminatesall conversations associated with the list.DdeEnableCallback,USER32.DLL,NM,3 enables or disables transactions fora specificconversation or for all conversations currentlyestablished by the calling application.DdeFreeDataHandle,USER32.DLL,NM,1, frees a dynamic data exchange (DDE) object anddeletes the data handle associated with the object.DdeFreeStringHandle,USER32.DLL,NM,2, frees a string handle in the calling application.DdeGetData,USER32.DLL,NM,4, copies data from the specified dynamic data exchange (DDE)object to the specified local buffer.DdeGetLastError,USER32.DLL,NM,1 returns the most recent error code set by the failure of aDynamic Data Exchange Management Library (DDEML) function and resets the error code toDMLERR_NO_ERROR.DdeImpersonateClient,USER32.DLL,NM,1, impersonates a dynamic data exchange (DDE)client application in a DDE client conversation.DdeInitialize,USER32.DLL,AW,4, registers an application with the Dynamic Data ExchangeManagement Library (DDEML).DdeKeepStringHandle,USER32.DLL,NM,2, increments the usage count associated with thespecified handle.DdeNameService,USER32.DLL,NM,4 registers or unregisters the service names a dynamicdata exchange (DDE) server supports.DdePostAdvise,USER32.DLL,NM,3 causes the system to send an XTYP_ADVREQ transactionto the calling (server) application?s dynamic data exchange (DDE) callback function for eachclient with an active advise loop on the specified topic and item.DdeQueryConvInfo,USER32.DLL,NM,3 obtains information about a dynamic data exchange(DDE) transaction and about the conversation in which the transaction takes place.DdeQueryNextServer,USER32.DLL,NM,2 obtains the next conversation handle in the specifiedconversation list.DdeQueryString,USER32.DLL,AW,5 copies text associated with a string handle into a buffer. +DdeReconnect,USER32.DLL,NM,1 allows a client Dynamic Data Exchange ManagementLibrary (DDEML) application to attempt to reestablish a conversation with a service that hasterminated a conversation with the client.DdeSetQualityOfService,USER32.DLL,NM,3 specifies the quality of service a raw DDEapplication desires for future DDE conversations it initiates.DdeSetUserHandle,USER32.DLL,NM,3, associates an application-defined 32- bit value with aconversation handle or a transaction identifier.DdeUnaccessData,USER32.DLL,NM,1, unaccesses a dynamic data exchange (DDE) object.DdeUninitialize,USER32.DLL,NM,1 frees all Dynamic Data ExchangeManagement Library(DDEML) resources associated with the callingapplication.DeallocateNtmsMedia,NTMSAPI.DLL,NM,3, deallocates the side associated with the specifiedlogical media.DebugActiveProcess,KERNEL32.DLL,NM,1, allows a debugger to attach to an active processand then debug it.DebugBreak,KERNEL32.DLL,NM,0 causes a breakpoint exception to occur inthe currentprocess so that the calling thread can signal thedebugger and force it to take some action.DecommissionNtmsMedia,NTMSAPI.DLL,NM,2, moves a side from the Available state to theDecommissioned state.DecryptMessage,SECUR32.DLL,NM,4,Decrypts a message by using Negotiate.DefDlgProc,USER32.DLL,AW,4 carries out default message processing fora window procedurebelonging to an application-defined dialog boxclass.DefFrameProc,USER32.DLL,AW,5 provides default processing for anywindow messages thatthe window procedure of a multiple documentinterface (MDI) frame window does not process.DefineDosDevice,KERNEL32.DLL,AW,3 lets an application define, redefine, or delete MS-DOSdevice names.

Page 126: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

126DefMDIChildProc,USER32.DLL,AW,4 provides default processing for anywindow message thatthe window procedure of a multiple documentinterface (MDI) child window does not process.DefWindowProc,USER32.DLL,AW,4 calls the default window procedure toprovide defaultprocessing for any window messages that anapplication does not process.DeinitMapiUtil,MAPI32.DLL,NM,0 releases utility functions calledexplicitly by the ScInitMapiUtilfunction or implicitly by theMAPIInitialize function.DeleteAce,ADVAPI32.DLL,NM,2, deletes an ACE from an ACL.DeleteColorTransform,MSCMS.DLL,NM,1, deletes a given color transform.DeleteCriticalSection,KERNEL32.DLL,NM,1, releases all resources used by an unowned criticalsection object.DeleteDC,GDI32.DLL,NM,1, deletes the specified device context (DC).DeleteEnhMetaFile,GDI32.DLL,NM,1, deletes an enhanced-format metafile or an enhanced-format metafile handle.DeleteFiber,KERNEL32.DLL,NM,1, deletes an existing fiber.DeleteFile,KERNEL32.DLL,AW,1, deletes an existing file.DeleteForm,WINMM.DLL,AW,2, removes a form name from the list of supported forms.DeleteMenu,USER32.DLL,NM,3, deletes an item from the specified menu.DeleteMetaFile,GDI32.DLL,NM,1, deletes a Windows-format metafile or Windows-formatmetafile handle.DeleteMonitor,WINMM.DLL,AW,3, removes a printer monitor added by the AddMonitorfunction.DeleteNtmsDrive,NTMSAPI.DLL,NM,2, deletes a drive from the RSM database. The drive musthave a dwOperationalState of NTMS_NOT_PRESENT.DeleteNtmsLibrary,NTMSAPI.DLL,NM,2, deletes a library, and all the devices contained in thelibrary, from the RSM database. All media in the library is moved to the offline library.DeleteNtmsMedia,NTMSAPI.DLL,NM,2, deletes a physical piece of offline media from RSM byremoving all references to the specified media from the database.DeleteNtmsMediaPool,NTMSAPI.DLL,NM,2, deletes the specified application media pool.DeleteNtmsMediaType,NTMSAPI.DLL,NM,3, deletes the specified media type relation from thespecified library, provided that the library does not contain any physical media objects of thespecified media type.DeleteObject,GDI32.DLL,NM,1 deletes a logical pen, brush, font, bitmap, region, or palette,freeing all system resources associated with the object.DeletePort,WINMM.DLL,AW,3, displays a dialog box that allows the user to delete a port name.DeletePrinter,WINMM.DLL,NM,1, deletes the specified printer object.DeletePrinterConnection,WINMM.DLL,AW,1 deletes a connection to aprinter that wasestablished by a call to AddPrinterConnection orConnectToPrinterDlg.DeletePrinterDriver,WINMM.DLL,AW,3 removes the specified printer-driver name from the listof names of supported drivers for aserver.DeletePrintProcessor,WINMM.DLL,AW,3, removes a printer processor added by theAddPrintProcessor function.DeletePrintProvidor,WINMM.DLL,AW,3, removes a printer provider added by theAddPrintProvidor function.DeleteSecurityContext,SECUR32.DLL,NM,1, deletes the local data structures associated withthe specified security context.DeleteService,ADVAPI32.DLL,NM,1 marks the specified service for deletion from the servicecontrol manager database.DeleteUrlCacheEntry,WININET.DLL,AW,1,Removes the file associated with the source namefrom the cache, if the file exists.DeleteUrlCacheGroup,WININET.DLL,NM,4,Releases the specified GROUPID and anyassociated state in the cache index file.DeregisterEventSource,ADVAPI32.DLL,NM,1, closes a handle to the specified event log.DeregisterIdleRoutine,MAPI32.DLL,NM,1, removes a FNIDLE - based idle routine from theMAPI system.DescribePixelFormat,GDI32.DLL,NM,4 obtains information about thepixel format identified byiPixelFormat of the device associatedwith hdc.DestroyAcceleratorTable,USER32.DLL,NM,1, destroys an accelerator table.DestroyCaret,USER32.DLL,NM,0, destroys the caret?s current shape, frees the caret from thewindow, and removes the caret from the screen.DestroyCursor,USER32.DLL,NM,1, destroys a cursor and frees any memory the cursoroccupied.DestroyEnvironmentBlock,USERENV.DLL,NM,1, frees environment variables created by theCreateEnvironmentBlock function.DestroyIcon,USER32.DLL,NM,1, destroys an icon and frees any memory the icon occupied.DestroyMenu,USER32.DLL,NM,1 destroys the specified menu and frees any memory that themenu occupies.DestroyPrivateObjectSecurity,ADVAPI32.DLL,NM,1 deletes a protected server object?ssecurity descriptor.DestroyPropertySheetPage,COMCTL32.DLL,NM,1, destroys a property sheet not been passedto the PropertySheet function.DestroyWindow,USER32.DLL,NM,1, destroys the specified window.DeviceCapabilities,WINMM.DLL,AW,5, retrieves the capabilities of a printer device driver.DeviceIoControl,KERNEL32.DLL,NM,8 sends a control code directly to a specified devicedriver, causing the corresponding device to perform the specified operation.DialogBoxIndirectParam,USER32.DLL,AW,5, creates a modal dialog box from a dialog boxtemplate in memory.DialogBoxParam,USER32.DLL,AW,5, creates a modal dialog box from a dialog box templateresource.DirectDrawCreate,DDRAW.DLL,NM,3,creates an instance of a DirectDraw object.DirectDrawCreateClipper,DDRAW.DLL,NM,3,creates an instance of a DirectDrawClipper objectnot associated with a DirectDraw object.DirectDrawEnumerate,DDRAW.DLL,AW,2,enumerates the primary DirectDraw display deviceand a nondisplay device (such as a 3-D accelerator that has no 2-D capabilities), if one isinstalled.DirectInputCreate,DINPUT.DLL,AW,4,This function creates a DirectInput object that supportsthe IDirectInput COM interface.DirectPlayCreate,DPLAY.DLL,NM,3,Creates an instance of a DirectPlay object.DirectPlayCreate,DPLAYX.DLL,NM,3,Creates an instance of a DirectPlay object.DirectPlayEnumerate,DPLAY.DLL,NM,2,Enumerates the DirectPlay service providers installedon the system.DirectPlayEnumerate,DPLAYX.DLL,AW,2,Enumerates the DirectPlay service providersinstalled on the system.DirectPlayLobbyCreate,DPLAYX.DLL,AW,5,Creates an instance of a DirectPlayLobby object.DirectXFileCreate,D3DXOF.DLL,NM,1,Creates an instance of a DirectXFile object.DirectXRegisterApplication,DSETUP.DLL,AW,2,Registers an ISV's game as an applicationdesigned to work with DirectPlayLobby.DirectXSetup,DSETUP.DLL,AW,3,Installs one or more DirectX components.DisableNtmsObject,NTMSAPI.DLL,NM,3, disables the specified RSM object.DisableThreadLibraryCalls,KERNEL32.DLL,NM,1, lets a DLL disable theDLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls.DisassociateColorProfileFromDevice,MSCMS.DLL,AW,3, disassociates a specified color profilewith a specified device on a specified computer.DisconnectNamedPipe,KERNEL32.DLL,NM,1, disconnects the server end of a named pipeinstance from a client process.DismountNtmsDrive,NTMSAPI.DLL,NM,2, queues a command to move the media in thespecified drive to its storage slot. This function should be paired with the MountNtmsMediafunction.DismountNtmsMedia,NTMSAPI.DLL,NM,4, queues a command to move the specified media ina drive to its storage. This function should be paired with the MountNtmsMedia function.

DispatchMessage,USER32.DLL,AW,1, dispatches a message to a window procedure.DispGetIDsOfNames,OLEAUT32.DLL,NM,4,Uses type information to convert a set of names toDISPIDs. This is the recommended implementation of IDispatch::GetIDsOfNames.DispGetParam,OLEAUT32.DLL,NM,5, This function retrieves a parameter from theDISPPARAMS structure, checks both named parameters and positional parameters, andcoerces the parameter to the specified type.DispInvoke,OLEAUT32.DLL,NM,8,Automatically calls member functions on an interface, giventhe type information for the interface. You can describe an interface with type information andimplement IDispatch::Invoke for the interface using this single call.DlgDirList,USER32.DLL,AW,5, fills the specified list box with the names of all files matching thespecified path or filename.DlgDirListComboBox,USER32.DLL,AW,5, fills the specified combo box with a directory listing.DlgDirSelectComboBoxEx,USER32.DLL,AW,4, retrieves the current selection from a combobox filled by using the DlgDirListComboBox function.DlgDirSelectEx,USER32.DLL,AW,4, retrieves the current selection from a single-selection listbox.DllDebugObjectRPCHook,OLE32.DLL,NM,2, This function is not yet supported.DllEntryPoint,EDBBCLI.DLL,NM,3, is an optional method of entry into a dynamic-link library(DLL).DllEntryPoint,MSCMS.DLL,NM,3, is an optional method of entry into a dynamic-link library(DLL).DocumentProperties,WINMM.DLL,AW,6 retrieves or modifies printerinitialization information ordisplays a printer-configurationdialog box for the specified printer.DoDragDrop,OLE32.DLL,NM,4,Carries out an OLE drag and drop operation.DosDateTimeToFileTime,KERNEL32.DLL,NM,3, converts MS-DOS date and time values to a64-bit file time.DosDateTimeToVariantTime,OLEAUT32.DLL,NM,3,Converts the MS-DOS representation oftime to the date and time representation stored in a variant.DPtoLP,GDI32.DLL,NM,3, converts device coordinates into logical coordinates.DragAcceptFiles,SHELL32.DLL,NM,2, registers whether a window accepts dropped files.DragDetect,USER32.DLL,NM,3 captures the mouse and tracks its movement until the userreleases the left button, presses the ESC key, or moves the mouse outside the ?dragrectangle? around the specified point.DragFinish,SHELL32.DLL,NM,1, releases memory that Windows allocated for use intransferring filenames to the application.DragQueryFile,SHELL32.DLL,AW,4, retrieves the filenames of dropped files.DragQueryPoint,SHELL32.DLL,NM,2, retrieves the position of the mouse pointer at the time afile was dropped.DrawAnimatedRects,USER32.DLL,NM,4 draws a wire-frame rectangle andanimates it toindicate the opening of an icon or the minimizing ormaximizing of a window.DrawCaption,USER32.DLL,NM,4, draws a window caption.DrawDibBegin,MSVFW32.DLL,NM,8 changes parameters of a DrawDib DC or initializes a newDrawDib DC.DrawDibChangePalette,MSVFW32.DLL,NM,4, sets the palette entries used for drawing DIBs.DrawDibClose,MSVFW32.DLL,NM,1, closes a DrawDib DC and frees the resources DrawDiballocated for it.DrawDibDraw,MSVFW32.DLL,NM,13, draws a DIB to the screen.DrawDibEnd,MSVFW32.DLL,NM,1 clears the flags and other settings of aDrawDib DC that areset by the DrawDibBegin or DrawDibDrawfunctions.DrawDibGetBuffer,MSVFW32.DLL,NM,4, retrieves the location of the buffer used by DrawDibfor decompression.DrawDibGetPalette,MSVFW32.DLL,NM,1, retrieves the palette used by a DrawDib DC.DrawDibOpen,MSVFW32.DLL,NM,0, opens the DrawDib library for use and creates a DrawDibDC for drawing.DrawDibProfileDisplay,MSVFW32.DLL,NM,1, determines settings for the display system whenusing DrawDib functions.DrawDibRealize,MSVFW32.DLL,NM,3, realizes the palette of the DrawDib DC for use with thespecified DC.DrawDibSetPalette,MSVFW32.DLL,NM,2 sets the palette used for drawing DIBs.DrawDibStart,MSVFW32.DLL,NM,2, prepares a DrawDib DC for streaming playback.DrawDibStop,MSVFW32.DLL,NM,1, frees the resources used by a DrawDib DC for streamingplayback.DrawDibTime,MSVFW32.DLL,NM,2, retrieves timing information about the drawing operationand is used during debug operations.DrawEdge,USER32.DLL,NM,4, draws one or more edges of rectangle.DrawEscape,GDI32.DLL,NM,4 accesses drawing capabilities of a video display that are notdirectly available through the graphics device interface (GDI).DrawFocusRect,USER32.DLL,NM,2, draws a rectangle in the style used to indicate that therectangle has the focus.DrawFrameControl,USER32.DLL,NM,4, draws a frame control of the specified type and style.DrawIcon,USER32.DLL,NM,4, draws an icon in the client area of the window of the specifieddevice context.DrawIconEx,USER32.DLL,NM,9 draws an icon or cursor in the client area of the window of thespecified device context, performing the specified raster operations, and stretching orcompressing the icon or cursor as specified.DrawInsert,COMCTL32.DLL,NM,3, draws the insert icon in the parent window of the specifieddrag list box.DrawMenuBar,USER32.DLL,NM,1, redraws the menu bar of the specified window.DrawState,USER32.DLL,AW,10, displays an image and applies a visual effect to indicate astate, such as a disabled or default state.DrawStatusText,COMCTL32.DLL,AW,4, draws the specified text in the style of a status windowwith borders.DrawText,USER32.DLL,AW,5, draws formatted text in the specified rectangle.DrawTextEx,USER32.DLL,AW,6 draws formatted text in the specified rectangle.DriveType,SHELL32.DLL,NM,1 Determines the drive type based on the drive number.DumpCAP,CAP.DLL,NM,0,Write data for the current instance of CAP.DLL. The name of thetext file is APPNAME.CAP.DuplicateHandle,KERNEL32.DLL,NM,7, duplicates an object handle.DuplicateToken,ADVAPI32.DLL,NM,3, creates a new access token that duplicates one alreadyin existence.DuplicateTokenEx,ADVAPI32.DLL,NM,6, creates a new access token that duplicates anexisting token.EjectNtmsCleaner,NTMSAPI.DLL,NM,4, ejects the cleaning cartridge from the currentlyreserved cleaner slot.EjectNtmsMedia,NTMSAPI.DLL,NM,4, ejects the specified medium from the port of the currentlibrary. If the library is busy, RSM queues EjectNtmsMedia and returns success.Ellipse,GDI32.DLL,NM,5 draws an ellipse. The center of the ellipse is the center of the specifiedbounding rectangle.EmptyClipboard,USER32.DLL,NM,0, empties the clipboard and frees handles to data in theclipboard.EmptyWorkingSet,PSAPI.DLL,NM,1, removes as many pages as possible from the working setof the specified process.EnableIdleRoutine,MAPI32.DLL,NM,2 enables or disables a FNIDLE based idle routine.EnableMenuItem,USER32.DLL,NM,3, enables, disables, or grays the specified menu item.EnableNtmsObject,NTMSAPI.DLL,NM,3, enables the specified object.EnableScrollBar,USER32.DLL,NM,3, enables or disables one or both scroll bar arrows.EnableWindow,USER32.DLL,NM,2, enables or disables mouse and keyboard input to thespecified window or control.

Page 127: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

127EncryptMessage,SECUR32.DLL,NM,4,Encrypts a message to provide privacy by usingNegotiate.EndDialog,USER32.DLL,NM,2, destroys a modal dialog box, causing the system to end anyprocessing for the dialog box.EndDoc,GDI32.DLL,NM,1 ends a print job. This function replaces the ENDDOC printer escape.EndDocPrinter,WINMM.DLL,NM,1, returns an error if the print job was not started by calling theStartDocPrinter function.EndPage,GDI32.DLL,NM,1 informs the device that the application has finished writing to apage.EndPagePrinter,WINMM.DLL,NM,1, indicates the end of one page and the beginning of thenext page for the specified printer.EndPaint,USER32.DLL,NM,2, marks the end of painting in the specified window.EndPath,GDI32.DLL,NM,1, closes a path bracket and selects the path defined by the bracketinto the specified device context.EndUpdateResource,KERNEL32.DLL,AW,2, ends a resource update in an executable file.EnterCriticalPolicySection,USERENV.DLL,NM,1, pauses the application of policy to allowapplications to safely read policy settings.EnterCriticalSection,KERNEL32.DLL,NM,1, waits for ownership of the specified critical sectionobject.EnumCalendarInfo,KERNEL32.DLL,AW,4, enumerates calendar information for a specifiedlocale.EnumChildWindows,USER32.DLL,NM,3, enumerates the child windows that belong to thespecified parent window by passing the handle of each child window, in turn, to an application-defined callback function.EnumClipboardFormats,USER32.DLL,NM,1, lets you enumerate the data formats that arecurrently available on the clipboard.EnumColorProfiles,MSCMS.DLL,AW,5, enumerates all the profiles satisfying the givenenumeration criteria.EnumDateFormats,KERNEL32.DLL,AW,3 enumerates the long or short dateformats that areavailable for a specified locale, including dateformats for any alternate calendars.EnumDependentServices,ADVAPI32.DLL,AW,6 provides the name and status of each servicethat depends on the specified service; that is, the specified service must be running before thedependent services can run.EnumDesktopWindows,USER32.DLL,NM,3 enumerates all windows in a desktopby passing thehandle of each window, in turn, to an application-defined callback function.EnumDeviceDrivers,PSAPI.DLL,NM,3, retrieves the load address for each device driver in thesystem.EnumDisplayMonitors,USER32.DLL,NM,4 enumerates display monitors (including invisiblepseudo-monitors associated with the mirroring drivers) that intersect a region formed by theintersection of a specified clipping rectangle and the visible region of a device context.EnumDisplaySettings,USER32.DLL,AW,3 obtains information about one of a display device?sgraphics modes.EnumEnhMetaFile,GDI32.DLL,NM,5 enumerates the records within anenhanced-formatmetafile by retrieving each record and passing itto the specified callback function.EnumerateNtmsObject,NTMSAPI.DLL,NM,6, enumerates the RSM objects contained in thelpContainerId parameter.EnumerateSecurityPackages,SECUR32.DLL,AW,2,Returns an array of SecPkgInfo structuresthat describe the security packages available to the client.EnumFontFamilies,GDI32.DLL,AW,4, enumerates the fonts in a specified font family that areavailable on a specified device.EnumFontFamiliesEx,GDI32.DLL,AW,5 enumerates all fonts in the systemthat match the fontcharacteristics specified by the LOGFONTstructure.EnumFonts,GDI32.DLL,AW,4, enumerates the fonts available on a specified device.EnumForms,WINMM.DLL,AW,6 enumerates the forms supported by the specified printer.EnumJobs,WINMM.DLL,AW,8 initializes an array of either JOB_INFO_1 orJOB_INFO_2structures with data describing the specified print jobsfor the specified printer.EnumMetaFile,GDI32.DLL,NM,4 enumerates the records within a Windows-format metafile byretrieving each record and passing it to the specified callback function.EnumMonitors,WINMM.DLL,AW,6 initializes an array of structures with data describing themonitors for the specified server.EnumObjects,GDI32.DLL,NM,4, enumerates the pens or brushes available for the specifieddevice context.EnumPorts,WINMM.DLL,AW,5, can succeed even if the server specified by pName does nothave a printer defined.EnumPrinterDrivers,WINMM.DLL,AW,7, enumerates all of the printer drivers installed on thespecified printer server.EnumPrinters,WINMM.DLL,AW,7, enumerates available printers, print servers, domains, orprint providers.EnumPrintProcessorDatatypes,WINMM.DLL,AW,7, enumerates the data types that a specifedprint processor supports.EnumPrintProcessors,WINMM.DLL,AW,7, enumerates the print processors installed on thespecified server.EnumProcesses,PSAPI.DLL,NM,3, retrieves the process identifier for each process object inthe system.EnumProcessModules,PSAPI.DLL,NM,4, retrieves a handle for each module in the specifiedprocess.EnumProps,USER32.DLL,AW,2 enumerates all entries in the property listof a window bypassing them, one by one, to the specified callbackfunction.EnumPropsEx,USER32.DLL,AW,3 enumerates all entries in the propertylist of a window bypassing them, one by one, to the specifiedcallback function.EnumProtocols,MSWSOCK.DLL,AW,3,Important is a Microsoft-specific extension to theWindows Sockets 1.EnumProtocols,WSOCK32.DLL,AW,3,Important is a Microsoft-specific extension to theWindows Sockets 1.EnumResourceLanguages,KERNEL32.DLL,AW,5 searches a module for eachresource of thespecified type and name and passes the language ofeach resource it locates to a definedcallback function.EnumResourceNames,KERNEL32.DLL,AW,4 searches a module for each resourceof thespecified type and passes the name of each resource itlocates to an application-definedcallback function.EnumResourceTypes,KERNEL32.DLL,AW,3 searches a module for resources andpasses eachresource type it finds to an application-definedcallback function.EnumServicesStatus,ADVAPI32.DLL,AW,8 enumerates services in the specified service controlmanager database.EnumSystemCodePages,KERNEL32.DLL,AW,2 enumerates the code pages that are eitherinstalled on or supported by a system.EnumSystemLocales,KERNEL32.DLL,AW,2, enumerates the locales that are either installed onor supported by a system.EnumThreadWindows,USER32.DLL,NM,3 enumerates all nonchild windows associated with athread by passing the handle of each window, in turn, to an application-defined callbackfunction.EnumTimeFormats,KERNEL32.DLL,AW,3, enumerates the time formats that are available for aspecified locale.EnumWindows,USER32.DLL,NM,2 enumerates all top-level windows on thescreen by passingthe handle of each window, in turn, to anapplication-defined callback function.EnumWindowStations,USER32.DLL,AW,2, enumerates only those window stations for whichthe calling process has WINSTA_ENUMERATE access.EqualPrefixSid,ADVAPI32.DLL,NM,2, tests two security-identifier (SID) prefix values forequality.

EqualRect,USER32.DLL,NM,2 determines whether the two specifiedrectangles are equal bycomparing the coordinates of their upper-left and lower-right corners.EqualRgn,GDI32.DLL,NM,2, checks the two specified regions to determine whether they areidentical.EqualSid,ADVAPI32.DLL,NM,2, tests two security identifier (SID) values.EraseTape,KERNEL32.DLL,NM,3 erases all or part of a tape.Escape,GDI32.DLL,NM,5, allows applications to access capabilities of a particular device notdirectly available through GDI.EscapeCommFunction,KERNEL32.DLL,NM,2, directs a specified communications device toperform an extended function.ExcludeClipRect,GDI32.DLL,NM,5 creates a new clipping region thatconsists of the existingclipping region minus the specifiedrectangle.ExcludeUpdateRgn,USER32.DLL,NM,2 prevents drawing within invalid areasof a window byexcluding an updated region in the window from aclipping region.ExitProcess,KERNEL32.DLL,NM,1,l does not return until no threads are in their DLLinitialization or detach routines.ExitThread,KERNEL32.DLL,NM,1, ends a thread.ExitWindowsEx,USER32.DLL,NM,2, returns as soon as it has initiated the shutdown.ExpandEnvironmentStrings,KERNEL32.DLL,AW,3, expands environment-variable strings andreplaces them with their defined values.ExpandEnvironmentStringsForUser,USERENV.DLL,AW,4, expands the source string by usingthe environment block established for the specified user.ExportNtmsDatabase,NTMSAPI.DLL,NM,1, creates a consistent set of database files in theRSM database directory.ExportSecurityContext,SECUR32.DLL,NM,4, creates a serialized representation of a securitycontext that can later be imported into a different process by calling ImportSecurityContext.ExtCreatePen,GDI32.DLL,NM,5, creates a logical cosmetic or geometric pen that has thespecified style, width, and brush attributes.ExtCreateRegion,GDI32.DLL,NM,3, creates a region from the specified region andtransformation data.ExtensionPropSheetPageProc,SETUPAPI.DLL,NM,3 specifies an application-defined callbackfunction that receives the address of the AddPropSheetPageProc function, which resides in themodule that creates a property sheet.ExtEscape,GDI32.DLL,NM,6, allows applications to access capabilities of a particular devicethat are not available through GDI.ExtFloodFill,GDI32.DLL,NM,5, fills an area of the display surface with the current brush.ExtractAssociatedIcon,SHELL32.DLL,AW,3 returns the handle of an indexedicon found in a fileor an icon found in an associated executablefile.ExtractIcon,SHELL32.DLL,AW,3 retrieves the handle of an icon from thespecified executablefile, dynamic-link library (DLL), or iconfile.ExtractIconEx,SHELL32.DLL,AW,5 retrieves the handle of an icon from thespecified executablefile, dynamic-link library (DLL), or iconfile.ExtSelectClipRgn,GDI32.DLL,NM,3 combines the specified region with the current clippingregion by using the specified mode.ExtTextOut,GDI32.DLL,AW,8, draws a character string by using the currently selected font.FatalAppExit,KERNEL32.DLL,AW,2 displays a message box and terminates the applicationwhen the message box is closed.FatalExit,KERNEL32.DLL,NM,1, transfers execution control to the debugger.FaxAbort,WINFAX.DLL,NM,2, A fax client application calls the FaxAbort function to terminate afax job.FaxAccessCheck,WINFAX.DLL,NM,2, A fax client application calls the FaxAccessCheckfunction to query the fax access privileges of a user.FaxClose,WINFAX.DLL,NM,1, closes the following types of fax handles: A fax server handlereturned by a call the FaxConnectFaxServer function A fax port handle returned by a callFaxCompleteJobParams,WINFAX.DLL,AW,2, creates both a FAX_COVERPAGE_INFOstructure and a FAX_JOB_PARAM structure for a fax client application.FaxConnectFaxServer,WINFAX.DLL,AW,2, connects a fax client application to the local faxserver.FaxEnableRoutingMethod,WINFAX.DLL,AW,3, enables or disables a fax routing method for aspecific fax device. A fax administration application typically calls this function for devicemanagement.FaxEnumGlobalRoutingInfo,WINFAX.DLL,AW,3, enumerates all fax routing methodsassociated with a specific fax server.FaxEnumJobs,WINFAX.DLL,AW,3, enumerates all queued and active fax jobs on the faxserver to which the client has connected. The function returns detailed information for each faxjob to the fax client application.FaxEnumPorts,WINFAX.DLL,AW,3, enumerates all fax devices currently attached to the faxserver to which the client has connected. The function returns detailed information for each faxport to the fax client application.FaxEnumRoutingMethods,WINFAX.DLL,AW,3, enumerates all fax routing methods for aspecific fax device. The function returns information about each routing method to a fax clientapplication.FaxFreeBuffer,WINFAX.DLL,NM,1, releases resources associated with a buffer allocatedpreviously as the result of a function call by a fax client application.FaxGetConfiguration,WINFAX.DLL,AW,2, returns to a fax client application the globalconfiguration settings for the fax server to which the client has connected.FaxGetDeviceStatus,WINFAX.DLL,AW,2, returns to a fax client application current statusinformation for the fax device of interest.FaxGetJob,WINFAX.DLL,AW,3, A fax client application calls the FaxGetJob function to retrievedetailed information for the specified queued or active fax job. The function returns theinformation in a FAX_JOB_ENTRY structure.FaxGetLoggingCategories,WINFAX.DLL,AW,3, returns to a fax client application the currentlogging categories for the fax server to which the client has connected.FaxGetPageData,WINFAX.DLL,NM,6, returns to a fax client application the first page of datafor a fax job. The fax job must be an outbound job, but it can be queued or active.FaxGetPort,WINFAX.DLL,AW,2, returns information for a specified fax port to a fax clientapplication.FaxGetRoutingInfo,WINFAX.DLL,AW,4, returns to a fax client application routing information fora fax routing method that is associated with a specific fax device.FaxInitializeEventQueue,WINFAX.DLL,NM,5, creates a fax event queue for the calling fax clientapplication. The queue enables the application to receive notifications of asynchronous eventsfrom the fax server.FaxOpenPort,WINFAX.DLL,NM,4, returns a fax port handle to a fax client application. The porthandle is required when the application calls other fax client functions that facilitate devicemanagement and fax document routing.FaxPrintCoverPage,WINFAX.DLL,AW,2, prints a fax transmission cover page to the specifieddevice context for a fax client application. A device context handle is obtained by using theFaxStartPrintJob function.FaxSendDocument,WINFAX.DLL,AW,5,ForBroadcast A fax client application calls theFaxSendDocumentForBroadcast function to queue several fax jobs that will transmit the sameoutgoing fax transmission to several recipients.FaxSendDocumentForBroadcast,WINFAX.DLL,AW,5, A fax client application calls theFaxSendDocumentForBroadcast function to queue several fax jobs that will transmit the sameoutgoing fax transmission to several recipients.FaxSetConfiguration,WINFAX.DLL,AW,2, A fax client application calls the FaxSetConfigurationfunction to change the global configuration settings for the fax server to which the client hasconnected.

Page 128: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

128FaxSetGlobalRoutingInfo,WINFAX.DLL,AW,2, A fax management application calls theFaxSetGlobalRoutingInfo function to modify fax routing method data, such as routing priority,that applies globally to the fax server.FaxSetJob,WINFAX.DLL,AW,4, A fax client application calls the FaxSetJob function to pause,resume, cancel, or restart a specified fax job.FaxSetLoggingCategories,WINFAX.DLL,AW,3, A fax client application calls theFaxSetLoggingCategories function to modify the current logging categories for the fax server towhich the client has connected.FaxSetPort,WINFAX.DLL,AW,2, A fax client application calls the FaxSetPort function to changethe configuration of the fax port of interest.FaxSetRoutingInfo,WINFAX.DLL,AW,4, A fax management application calls theFaxSetRoutingInfo function to modify the routing information for a fax routing method that isassociated with a specific fax device.FaxStartPrintJob,WINFAX.DLL,AW,4, A fax client application calls the FaxStartPrintJobfunction to start printing an outbound fax transmission on the specified fax printer. The functionreturns a handle to a device context.FBadColumnSet,MAPI32.DLL,NM,1 tests the validity of a table column setfor use by a serviceprovider in a subsequent call to theIMAPITable::SetColumns method.FBadEntryList,MAPI32.DLL,NM,1, validates a list of MAPI entry identifiers.FBadProp,MAPI32.DLL,NM,1, validates a specified property.FBadPropTag,MAPI32.DLL,NM,1, validates a specified property tag.FBadRestriction,MAPI32.DLL,NM,1, validates a restriction used to limit a table view.FBadRglpNameID,MAPI32.DLL,NM,2, validates an array of structures that describe namedproperties and verifies their allocation.FBadRglpsz,MAPI32.DLL,AW,2 validates all strings in an array of Unicode strings.FBadRow,MAPI32.DLL,NM,1, validates a row in a table.FBadRowSet,MAPI32.DLL,NM,1, validates all table rows included in a set of table rows.FBadSortOrderSet,MAPI32.DLL,NM,1, validates a sort order set by verifying its memoryallocation.FBinFromHex,MAPI32.DLL,NM,2 converts a string representation of a hexadecimal number tobinary data.FEqualNames,MAPI32.DLL,NM,2, determines whether two MAPI named properties are thesame.FileTimeToDosDateTime,KERNEL32.DLL,NM,3, converts a 64-bit file time to MS-DOS dateand time values.FileTimeToLocalFileTime,KERNEL32.DLL,NM,2, converts a file time based on the CoordinatedUniversal Time (UTC) to a local file time.FileTimeToSystemTime,KERNEL32.DLL,NM,2, converts a 64-bit file time to system timeformat.FillConsoleOutputAttribute,KERNEL32.DLL,NM,5 sets the text and background color attributesfor a specified number of charactercells, beginning at the specified coordinates in a screenbuffer.FillConsoleOutputCharacter,KERNEL32.DLL,AW,5 writes a character to the screen buffer aspecified number of times, beginning at the specified coordinates.FillPath,GDI32.DLL,NM,1 closes any open figures in the current pathand fills the path?s interiorby using the current brush andpolygon-filling mode.FillRect,USER32.DLL,NM,3, fills a rectangle by using the specified brush.FillRgn,GDI32.DLL,NM,3, fills a region by using the specified brush.FindAtom,KERNEL32.DLL,AW,1 searches the local atom table for thespecified character stringand retrieves the atom associated withthat string.FindClose,KERNEL32.DLL,NM,1, closes the specified search handle.FindCloseChangeNotification,KERNEL32.DLL,NM,1, stops change notification handlemonitoring.FindClosePrinterChangeNotification,WINMM.DLL,NM,1 closes a change notification objectcreated by calling the FindFirstPrinterChangeNotification function.FindCloseUrlCache,WININET.DLL,NM,1,Closes the specified cache enumeration handle.FindDebugInfoFile,IMAGEHLP.DLL,NM,3, locates a debug (.dbg) file.FindExecutable,SHELL32.DLL,AW,3, retrieves the name and handle to the executable (.FindExecutableImage,IMAGEHLP.DLL,NM,3, locates an executable file.FindFirstChangeNotification,KERNEL32.DLL,AW,3 creates a change notification handle andsets up initial change notification filter conditions.FindFirstFile,KERNEL32.DLL,AW,2, searches a directory for a file whose name matches thespecified filename.FindFirstFileEx,KERNEL32.DLL,AW,6, searches a directory for a file whose name andattributes match those specified in the function call.FindFirstFreeAce,ADVAPI32.DLL,NM,2, retrieves a pointer to the first free byte in an access-control list (ACL).FindFirstPrinterChangeNotification,WINMM.DLL,NM,3, creates a change notification object andreturns a handle to the object.FindFirstUrlCacheEntry,WININET.DLL,AW,3,Begins the enumeration of the Internet cache.FindFirstUrlCacheEntryEx,WININET.DLL,AW,10,Starts a filtered enumeration of the Internetcache.FindFirstUrlCacheGroup,WININET.DLL,NM,6,Initiates the enumeration of the cache groups inthe Internet cache.FindMediaType,URLMON.DLL,NM,2,Class Retrieves the CLSID for the specified media type.FindMediaTypeClass,URLMON.DLL,NM,4, Retrieves the CLSID for the specified media type.FindNextChangeNotification,KERNEL32.DLL,NM,1 requests that the operating system signal achange notification handle the next time it detects an appropriate change.FindNextFile,KERNEL32.DLL,AW,2, continues a file search from a previous call to theFindFirstFile function.FindNextPrinterChangeNotification,WINMM.DLL,NM,3 retrieves information about the mostrecent change notification for a change notification object associated with a printer or printserver.FindNextUrlCacheEntry,WININET.DLL,AW,3,Retrieves the next entry in the Internet cache.FindNextUrlCacheEntryEx,WININET.DLL,AW,6,Finds the next cache entry in a cacheenumeration started by the FindFirstUrlCacheEntryEx function.FindNextUrlCacheGroup,WININET.DLL,NM,3,Retrieves the next cache group in a cache groupenumeration started by FindFirstUrlCacheGroup.FindResource,KERNEL32.DLL,AW,3 determines the location of a resource with the specifiedtype and name in the specified module.FindResourceEx,KERNEL32.DLL,AW,4 determines the location of the resourcewith thespecified type, name, and language in the specifiedmodule.FindText,COMDLG32.DLL,AW,1 creates a system-defined modeless dialog boxthat lets theuser specify a string to search for and options touse when searching for text in a document.FindWindow,USER32.DLL,AW,2 retrieves the handle to the top-levelwindow whose class nameand window name match the specifiedstrings.FindWindowEx,USER32.DLL,AW,4 retrieves the handle to a window whose class name andwindow name match the specified strings.FixBrushOrgEx,GDI32.DLL,NM,4, is not implemented in the Win32 API.FlashWindow,USER32.DLL,NM,2, flashes the window only once; for repeated flashing, theapplication should create a system timer.FlatSB_EnableScrollBar,COMCTL32.DLL,NM,3,Enables or disables one or both flat scroll bardirection buttons.FlatSB_GetScrollInfo,COMCTL32.DLL,NM,3,Retrieves the information for a flat scroll bar.FlatSB_GetScrollPos,COMCTL32.DLL,NM,2,Retrieves the thumb position in a flat scroll bar.FlatSB_GetScrollProp,COMCTL32.DLL,NM,3,Retrieves the properties for a flat scroll bar.FlatSB_GetScrollRange,COMCTL32.DLL,NM,4,Retrieves the scroll range for a flat scroll bar.FlatSB_SetScrollInfo,COMCTL32.DLL,NM,4,Sets the information for a flat scroll bar.

FlatSB_SetScrollPos,COMCTL32.DLL,NM,4,Sets the current position of the thumb in a flatscroll bar.FlatSB_SetScrollProp,COMCTL32.DLL,NM,4,Sets the properties for a flat scroll bar.FlatSB_SetScrollRange,COMCTL32.DLL,NM,5,Sets the scroll range of a flat scroll bar.FlatSB_ShowScrollBar,COMCTL32.DLL,NM,3,Shows or hides a flat scroll bar.FlattenPath,GDI32.DLL,NM,1 transforms any curves in the path that isselected into the currentdevice context (DC), turning each curveinto a sequence of lines.FloodFill,GDI32.DLL,NM,4, fills an area of the display surface with the current brush.FlushConsoleInputBuffer,KERNEL32.DLL,NM,1 flushes the console input buffer. All inputrecords currently in the input buffer are discarded.FlushFileBuffers,KERNEL32.DLL,NM,1, clears the buffers for the specified file and causes allbuffered data to be written to the file.FlushInstructionCache,KERNEL32.DLL,NM,3, flushes the instruction cache for the specifiedprocess.FlushViewOfFile,KERNEL32.DLL,NM,2, writes to the disk a byte range within a mapped view ofa file.FmtIdToPropStgName,IPROP.DLL,NM,2,Converts a property set format identifier (FMTID) toits storage or stream name.FoldString,KERNEL32.DLL,AW,5, maps one string to another, performing a specifiedtransformation option.FormatMessage,KERNEL32.DLL,AW,7, formats a message string.FPropCompareProp,MAPI32.DLL,NM,3, compares two property values using a binary relationaloperator.FPropContainsProp,MAPI32.DLL,NM,3 compares two property values,generally strings orbinary arrays, to see if one contains theother.FPropExists,MAPI32.DLL,NM,2 searches for a given property tag in anIMAPIProp interface oran interface derived from IMAPIProp, such asIMessage or IMAPIFolder.FrameRect,USER32.DLL,NM,3, draws a border around the specified rectangle by using thespecified brush.FrameRgn,GDI32.DLL,NM,5, draws a border around the specified region by using the specifiedbrush.FreeConsole,KERNEL32.DLL,NM,0, detaches the calling process from its console.FreeContextBuffer,SECUR32.DLL,NM,1,Enables callers of security package functions to free amemory buffer that was allocated by the security package as a result of calls toInitializeSecurityContext (General) and AcceptSecurityContext (General).FreeCredentialsHandle,SECUR32.DLL,NM,1,Notifies the security system that the credentialsare no longer needed. An application calls this function to free the credential handle acquired inthe call to the AcquireCredentialsHandle (General) function.FreeDDElParam,USER32.DLL,NM,2, frees the memory specified by the lParam parameter of aposted DDE message.FreeEnvironmentStrings,KERNEL32.DLL,AW,1 frees a block of environment strings.FreeGPOList,USERENV.DLL,AW,1, frees the specified linked list of GPOs.FreeLibrary,KERNEL32.DLL,NM,1, decrements the reference count of the loaded dynamic-linklibrary (DLL) module.FreeLibraryAndExitThread,KERNEL32.DLL,NM,2 decrements the reference count of a loadeddynamic-link library (DLL) by one, and then calls ExitThread to terminate the calling thread.FreePadrlist,MAPI32.DLL,NM,1 destroys an ADRLIST structure and freesassociated memory,including memory allocated for all member arraysand structures.FreePrinterNotifyInfo,WINMM.DLL,NM,1 frees a system-allocated bufferthat was returned bythe FindNextPrinterChangeNotificationfunction.FreePropVariantArray,IPROP.DLL,NM,2, calls PropVariantClear on each of thePROPVARIANT structures in the rgvars array to make the value zero for each of the membersof the array.FreePropVariantArray,OLE32.DLL,NM,2, calls PropVariantClear on each of thePROPVARIANT structures in the rgvars array to make the value zero for each of the membersof the array.FreeProws,MAPI32.DLL,NM,1 destroys an SRowSet structure and freesassociated memory,including memory allocated for all member arraysand structures.FreeResource,KERNEL32.DLL,NM,1, is obsolete.FreeSid,ADVAPI32.DLL,NM,1, frees a security identifier (SID) previously allocated by using theAllocateAndInitializeSid function.FtAddFt,MAPI32.DLL,NM,4, adds one unsigned 64-bit integer to another.FtgRegisterIdleRoutine,MAPI32.DLL,NM,5, adds a FNIDLE - based idle routine to the MAPIsystem.FtMulDw,MAPI32.DLL,NM,3, multiplies an unsigned 64-bit integer by an unsigned 32-bitinteger.FtMulDwDw,MAPI32.DLL,NM,2, multiplies one unsigned 32-bit integer by another.FtNegFt,MAPI32.DLL,NM,2, computes the two?s complement of an unsigned 64-bit integer.FtpCommand,WININET.DLL,AW,6,Sends commands directly to an FTP server.FtpCreateDirectory,WININET.DLL,AW,2,Creates a new directory on the FTP server.FtpDeleteFile,WININET.DLL,AW,2,Deletes a file stored on the FTP server.FtpFindFirstFile,WININET.DLL,AW,5,Searches the specified directory of the given FTP session.File and directory entries are returned to the application in the WIN32_FIND_DATA structure.FtpGetCurrentDirectory,WININET.DLL,AW,3,Retrieves the current directory for the specifiedFTP session.FtpGetFile,WININET.DLL,AW,7,Retrieves a file from the FTP server and stores it under thespecified file name, creating a new local file in the process.FtpGetFileEx,WININET.DLL,NM,7,retrieves a file from the FTP server and stores it under thespecified file name, creating a new local file in the process.FtpGetFileSize,WININET.DLL,NM,2,Retrieves the file size of the requested FTP resource.FtpOpenFile,WININET.DLL,AW,5,Initiates access to a remote file on an FTP server for readingor writing.FtpPutFile,WININET.DLL,AW,5,Stores a file on the FTP server.FtpPutFileEx,WININET.DLL,NM,5,This function stores a file on the FTP server.FtpRemoveDirectory,WININET.DLL,AW,2,Removes the specified directory on the FTP server.FtpRenameFile,WININET.DLL,AW,3,Renames a file stored on the FTP server.FtpSetCurrentDirectory,WININET.DLL,AW,2,Changes to a different working directory on theFTP server.FtSubFt,MAPI32.DLL,NM,4, subtracts one unsigned 64-bit integer from another.GdiComment,GDI32.DLL,NM,3, copies a comment from a buffer into a specified enhancedformat metafile.GdiFlush,GDI32.DLL,NM,0, flushes the calling thread?s current batch.GdiGetBatchLimit,GDI32.DLL,NM,0, returns the batch limit.GdiSetBatchLimit,GDI32.DLL,NM,1, sets the maximum number of functions that can beaccumulated in the calling thread?s current batch.GenerateConsoleCtrlEvent,KERNEL32.DLL,NM,2 sends a specified signal to aconsole processgroup that shares the console associated with thecalling process.GenerateCopyFilePaths,MSCMS.DLL,NM,9,graphics, GraphicsDrivers, Reference,GenerateCopyFilePathsGetAcceptExSockaddrs,MSWSOCK.DLL,NM,8, parses the data obtained from a call to theAcceptEx function and passes the local and remote addresses to a SOCKADDR structure.GetAcceptExSockaddrs,WSOCK32.DLL,NM,8, parses the data obtained from a call to theAcceptEx function and passes the local and remote addresses to a SOCKADDR structure.GetAclInformation,ADVAPI32.DLL,NM,4, retrieves information about an access-control list(ACL).GetACP,KERNEL32.DLL,NM,0, retrieves the current ANSI code-page identifier for the system.GetActiveObject,OLEAUT32.DLL,NM,3,Retrieves a pointer to a running object that has beenregistered with OLE.

Page 129: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

129GetActiveWindow,USER32.DLL,NM,0, retrieves the window handle to the active windowassociated with the thread that calls the function.GetAddressByName,MSWSOCK.DLL,AW,10,Important is a Microsoft-specific extension to theWindows Sockets 1.GetAddressByName,WSOCK32.DLL,AW,10,Important is a Microsoft-specific extension to theWindows Sockets 1.GetAllUsersProfileDirectory,USERENV.DLL,AW,2, retrieves the path to the root of the All Usersprofile.GetAltMonthNames,OLEAUT32.DLL,NM,2,Retrieves the secondary (altername) month names.GetAppliedGPOList,USERENV.DLL,AW,5, retrieves the list of GPOs applied for the specifieduser or computer and the specified extension.GetArcDirection,GDI32.DLL,NM,1, returns the current arc direction for the specified devicecontext..GetAspectRatioFilterEx,GDI32.DLL,NM,2, retrieves the setting for the current aspect-ratio filter.GetAsyncKeyState,USER32.DLL,NM,1 determines whether a key is up ordown at the time thefunction is called, and whether the key waspressed after a previous call to GetAsyncKeyState.GetAtomName,KERNEL32.DLL,AW,3, retrieves a copy of the character string associated withthe specified local atom.GetAttribIMsgOnIStg,MAPI32.DLL,NM,3, retrieves attributes of properties on an IMessageobject supplied by the OpenIMsgOnIStg function.GetAuditedPermissionsFromAcl,ADVAPI32.DLL,AW,4, returns the audited access rights for aspecified trustee.GetBinaryType,KERNEL32.DLL,AW,2, determines whether a file is executable, and if so, whattype of executable file it is.GetBitmapBits,GDI32.DLL,NM,3, is obsolete.GetBitmapDimensionEx,GDI32.DLL,NM,2, retrieves the dimensions of aSetBitmapDimensionEx function.GetBkColor,GDI32.DLL,NM,1, returns the current background color for the specified devicecontext.GetBkMode,GDI32.DLL,NM,1, returns the current background mix mode for a specified devicecontext.GetBoundsRect,GDI32.DLL,NM,3 obtains the current accumulated bounding rectangle for aspecified device context.GetBrushOrgEx,GDI32.DLL,NM,2, retrieves the current brush origin for the specified devicecontext.GetCapture,USER32.DLL,NM,0, retrieves the handle of the window (if any) that has capturedthe mouse.GetCaretBlinkTime,USER32.DLL,NM,0, returns the elapsed time, in milliseconds, required toinvert the caret?s pixels.GetCaretPos,USER32.DLL,NM,1, copies the caret?s position, in client coordinates, to thespecified POINT structure.GetCharABCWidths,GDI32.DLL,AW,4 retrieves the widths, in logicalunits, of consecutivecharacters in a given range from the currentTrueType font.GetCharABCWidthsFloat,GDI32.DLL,AW,4 retrieves the widths, in logicalunits, of consecutivecharacters in a specified range from thecurrent font.GetCharacterPlacement,GDI32.DLL,AW,6 retrieves information about a character string, suchas character widths, caret positioning, ordering within the string, and glyph rendering.GetCharWidth,GDI32.DLL,AW,4 retrieves the widths, in logicalcoordinates, of consecutivecharacters in a specified range fromthe current font.GetCharWidth32,GDI32.DLL,AW,4 retrieves the widths, in logicalcoordinates, of consecutivecharacters in a specified range fromthe current font.GetCharWidthFloat,GDI32.DLL,AW,4, retrieves the fractional widths of consecutive charactersin a specified range from the current font.GetClassFile,OLE32.DLL,NM,2,OrMime Retrieves the CLSID of the object to instantiate for thespecified file.GetClassFileOrMime,URLMON.DLL,NM,7, Retrieves the CLSID of the object to instantiate forthe specified file.GetClassInfo,USER32.DLL,AW,3, retrieves information about a window class.GetClassInfoEx,USER32.DLL,AW,3 retrieves information about a windowclass, including thehandle of the small icon associated with thewindow class.GetClassLong,USER32.DLL,AW,2 retrieves the specified 32-bit (long)value from theWNDCLASSEX structure associated with the specifiedwindow.GetClassName,USER32.DLL,AW,3, retrieves the name of the class to which the specifiedwindow belongs.GetClassURL,URLMON.DLL,NM,2, GetClassURL Function Not currently implemented.GetClassWord,USER32.DLL,NM,2 retrieves the 16-bit (word) value at thespecified offset intothe extra class memory for the window classto which the specified window belongs.GetClientRect,USER32.DLL,NM,2 retrieves the coordinates of a window?s client area.GetClipboardData,USER32.DLL,NM,1, retrieves data from the clipboard in a specified format.GetClipboardFormatName,USER32.DLL,AW,3, retrieves from the clipboard the name of thespecified registered format.GetClipboardOwner,USER32.DLL,NM,0, retrieves the window handle of the current owner ofthe clipboard.GetClipboardSequenceNumber,USER32.DLL,NM,0, returns the clipboard sequence number forthe current window station.GetClipboardViewer,USER32.DLL,NM,0, retrieves the handle of the first window in theclipboard viewer chain.GetClipBox,GDI32.DLL,NM,2 retrieves the dimensions of the tightestbounding rectangle thatcan be drawn around the current visiblearea on the device.GetClipCursor,USER32.DLL,NM,1, retrieves the screen coordinates of the rectangular area towhich the cursor is confined.GetClipRgn,GDI32.DLL,NM,2 retrieves a handle identifying the currentapplication-definedclipping region for the specified devicecontext.GetCMMInfo,MSCMS.DLL,NM,2, retrieves various information about the color managementmodule (CMM) that created the specified color transform.GetColorAdjustment,GDI32.DLL,NM,2 retrieves the color adjustmentvalues for the specifieddevice context.GetColorDirectory,MSCMS.DLL,AW,3, retrieves the path of the Windows COLOR directory ona specified machine.GetColorProfileElement,MSCMS.DLL,NM,6, copies data from a specified tagged profileelement of a specified color profile into a buffer.GetColorProfileElementTag,MSCMS.DLL,NM,3, retrieves the tag name specified by dwIndex inthe tag table of a given color profile, where dwIndex is a one-based index into that table.GetColorProfileFromHandle,MSCMS.DLL,NM,3,Given a handle to an open color profile, theGetColorProfileFromHandle function will copy the contents of the profile into a buffer suppliedby the application.GetColorProfileHeader,MSCMS.DLL,NM,2, retrieves the header of a color profile.GetCommandLine,KERNEL32.DLL,AW,0 returns a pointer to the command-line string for thecurrent process.GetCommConfig,KERNEL32.DLL,NM,3 gets the current configuration of a communicationsdevice.GetCommMask,KERNEL32.DLL,NM,2, retrieves the value of the event mask for a specifiedcommunications device.GetCommModemStatus,KERNEL32.DLL,NM,2, retrieves modem control-register values.GetCommProperties,KERNEL32.DLL,NM,2 fills a buffer with informationabout thecommunications properties for a specified communicationsdevice.GetCommState,KERNEL32.DLL,NM,2 fills in a device-control block (a DCBstructure) with thecurrent control settings for a specifiedcommunications device.

GetCommTimeouts,KERNEL32.DLL,NM,2, retrieves the time-out parameters for all read andwrite operations on a specified communications device.GetCompressedFileSize,KERNEL32.DLL,AW,2, obtains the compressed size of a file.GetComputerName,KERNEL32.DLL,AW,2, retrieves the computer name of the current system.GetComputerObjectName,SECUR32.DLL,AW,3, retrieves the local computer's name in aspecified format.GetConsoleCP,KERNEL32.DLL,NM,0 Windows NT: returns the identity of theinput code pageused by the console associated with the callingprocess.GetConsoleCursorInfo,KERNEL32.DLL,NM,2 retrieves information about thesize and visibilityof the cursor for the specified console screenbuffer.GetConsoleMode,KERNEL32.DLL,NM,2 reports the current input mode of aconsole?s inputbuffer or the current output mode of a consolescreen buffer.GetConsoleOutputCP,KERNEL32.DLL,NM,0 Windows NT: returns the identity ofthe outputcode page used by the console associated with thecalling process.GetConsoleScreenBufferInfo,KERNEL32.DLL,NM,2, retrieves information about the specifiedconsole screen buffer.GetConsoleTitle,KERNEL32.DLL,AW,2, retrieves the title bar string for the current consolewindow.GetConvertStg,OLE32.DLL,NM,1, returns the current value of the convert bit for the specifiedstorage object.GetCountColorProfileElements,MSCMS.DLL,NM,2, retrieves the number of tagged elements ina given color profile.GetCPInfo,KERNEL32.DLL,NM,2, retrieves information about any valid installed or availablecode page.GetCurrencyFormat,KERNEL32.DLL,AW,6, formats a number string as a currency string for aspecified locale.GetCurrentDirectory,KERNEL32.DLL,AW,2 retrieves the current directory for the currentprocess.GetCurrentHwProfile,ADVAPI32.DLL,AW,1, retrieves the display name and globally uniqueidentifier (GUID) string for the hardware profile.GetCurrentObject,GDI32.DLL,NM,2, obtains a handle to a device context? s currently selectedobject of a specified type.GetCurrentPositionEx,GDI32.DLL,NM,2, retrieves the current position in logical coordinates.GetCurrentProcess,KERNEL32.DLL,NM,0, returns a pseudohandle for the current process.GetCurrentProcessId,KERNEL32.DLL,NM,0, returns the process identifier of the callingprocess.GetCurrentThread,KERNEL32.DLL,NM,0, returns a pseudohandle for the current thread.GetCurrentThreadId,KERNEL32.DLL,NM,0, returns the thread identifier of the calling thread.GetCursor,USER32.DLL,NM,0, retrieves the handle of the current cursor.GetCursorPos,USER32.DLL,NM,1, retrieves the cursor?s position, in screen coordinates.GetDateFormat,KERNEL32.DLL,AW,6 formats a date as a date string for a specified locale.GetDC,USER32.DLL,NM,1, retrieves a handle of a display device context (DC) for the clientarea of the specified window.GetDCEx,USER32.DLL,NM,3, retrieves the handle of a display device (DC) context for thespecified window.GetDCOrgEx,GDI32.DLL,NM,2, obtains the final translation origin for a specified device context(DC).GetDefaultCommConfig,KERNEL32.DLL,AW,3, gets the default configuration for acommunications device.GetDefaultUserProfileDirectory,USERENV.DLL,AW,2, retrieves the path to the root of theDefault User profile.GetDesktopWindow,USER32.DLL,NM,0, returns the handle of the Windows desktop window.GetDeviceCaps,GDI32.DLL,NM,2, retrieves device-specific information about a specifieddevice.GetDeviceDriverBaseName,PSAPI.DLL,AW,3, retrieves the base name of the specified devicedriver.GetDeviceDriverFileName,PSAPI.DLL,AW,3, retrieves the fully qualified path for the specifieddevice driver.GetDialogBaseUnits,USER32.DLL,NM,0 returns the system's dialog baseunits, which are theaverage width and height of characters in thesystem font.GetDIBColorTable,GDI32.DLL,NM,4 retrieves RGB (red, green, blue) color values from a rangeof entries in the color table of the DIB section bitmap that is currently selected into a specifieddevice context.GetDIBits,GDI32.DLL,NM,7, retrieves the bits of the specified bitmap and copies them into abuffer using the specified format.GetDiskFreeSpace,KERNEL32.DLL,AW,5, retrieves information about the specified disk,including the amount of free space on the disk.GetDiskFreeSpaceEx,KERNEL32.DLL,AW,4, lets you avoid the arithmetic required by theGetDiskFreeSpace function.GetDlgCtrlID,USER32.DLL,NM,1, returns the identifier of the specified control.GetDlgItem,USER32.DLL,NM,2, retrieves the handle of a control in the specified dialog box.GetDlgItemInt,USER32.DLL,NM,4, translates the text of a specified control in a dialog box intoan integer value.GetDlgItemText,USER32.DLL,AW,4, retrieves the title or text associated with a control in adialog box.GetDoubleClickTime,USER32.DLL,NM,0, retrieves the current double-click time for the mouse.GetDriveType,KERNEL32.DLL,AW,1, determines whether a disk drive is a removable, fixed,CD-ROM, RAM disk, or network drive.GetEffectiveClientRect,COMCTL32.DLL,NM,3, calculates the dimensions of a rectangle in theclient area.GetEffectiveRightsFromAcl,ADVAPI32.DLL,AW,3, retrieves the effective access rights that anACL allows for a specified trustee.GetEnhMetaFile,GDI32.DLL,AW,1, creates a handle that identifies the enhanced-formatmetafile stored in the specified file.GetEnhMetaFileBits,GDI32.DLL,NM,3, retrieves the contents of the specified enhanced-formatmetafile and copies them into a buffer.GetEnhMetaFileDescription,GDI32.DLL,AW,3 retrieves an optional textdescription from anenhanced-format metafile and copies the stringto the specified buffer.GetEnhMetaFileHeader,GDI32.DLL,NM,3 retrieves the record containing the header for thespecified enhanced-format metafile.GetEnhMetaFilePaletteEntries,GDI32.DLL,NM,3, retrieves optional palette entries from thespecified enhanced metafile.GetEnvironmentStrings,KERNEL32.DLL,AW,0, returns the address of the environment block forthe current process.GetEnvironmentVariable,KERNEL32.DLL,AW,3 retrieves the value of thespecified variable fromthe environment block of the callingprocess.GetErrorInfo,OLEAUT32.DLL,NM,2,Obtains the error information pointer set by the previouscall to SetErrorInfo in the current logical thread.GetExitCodeProcess,KERNEL32.DLL,NM,2 retrieves the termination status ofthe specifiedprocess.GetExitCodeThread,KERNEL32.DLL,NM,2, retrieves the termination status of the specifiedthread.GetExpandedName,LZ32.DLL,AW,2 retrieves the original name of acompressed file, if the filewas compressed by using the MicrosoftFile Compression Utility (COMPRESS.GetExplicitEntriesFromAcl,ADVAPI32.DLL,AW,3 retrieves an array ofEXPLICIT_ACCESSstructures that describe the access-control entries(ACEs) in an access-control list (ACL).GetFileAttributes,KERNEL32.DLL,AW,1, returns attributes for a specified file or directory.GetFileAttributesEx,KERNEL32.DLL,AW,3, obtains attribute information about a specified file ordirectory.

Page 130: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

130GetFileInformationByHandle,KERNEL32.DLL,NM,2, retrieves information about a specified file.GetFileSecurity,ADVAPI32.DLL,AW,5, obtains specified information about the security of a fileor directory.GetFileSize,KERNEL32.DLL,NM,2, retrieves the size, in bytes, of the specified file.GetFileTime,KERNEL32.DLL,NM,4, retrieves the date and time that a file was created, lastaccessed, and last modified.GetFileTitle,COMDLG32.DLL,AW,3, returns the name of the file identified by the lpszFileparameter.GetFileType,KERNEL32.DLL,NM,1 returns the type of the specified file.GetFileVersionInfo,VERSION.DLL,AW,4, returns version information about a specified file.GetFileVersionInfoSize,VERSION.DLL,AW,2 determines whether operating system can obtainversion information about a specifiedfile.GetFocus,USER32.DLL,NM,0 retrieves the handle of the window that hasthe keyboard focus, ifthe window is associated with the callingthread?s message queue.GetFontData,GDI32.DLL,NM,5, retrieves font metric data for a TrueType font.GetFontLanguageInfo,GDI32.DLL,NM,1, returns information about the currently selected fontfor the specified display context.GetForegroundWindow,USER32.DLL,NM,0 returns the handle of theforeground window (thewindow with which the user is currentlyworking).GetForm,WINMM.DLL,AW,6, initializes a FORM_INFO_1 structure with data describing thespecified form for a printer.GetFullPathName,KERNEL32.DLL,AW,4, retrieves the full path and filename of a specified file.GetGlyphOutline,GDI32.DLL,AW,7 retrieves the outline or bitmap for acharacter in theTrueType font that is selected into the specifieddevice context.GetGPOList,USERENV.DLL,AW,6, retrieves the list of GPOs for the specified user orcomputer.GetGraphicsMode,GDI32.DLL,NM,1, retrieves the current graphics mode for the specifieddevice context.GetGuiResources,USER32.DLL,NM,2 returns the count of handles to graphical user interface(GUI) objects in use by the specified process.GetHandleInformation,KERNEL32.DLL,NM,2, obtains information about certain properties of anobject handle.GetHGlobalFromILockBytes,OLE32.DLL,NM,2, retrieves a global memory handle to a bytearray object created using the CreateILockBytesOnHGlobal function.GetHGlobalFromStream,OLE32.DLL,NM,2, This function retrieves the global memory handle toa stream that was created through a call to the CreateStreamOnHGlobal function.gethostbyaddr,WS2_32.DLL,NM,3 retrieves the host information corresponding to a networkaddress.gethostbyaddr,WSOCK32.DLL,NM,3 retrieves the hostinformation corresponding to a networkaddress.gethostbyname,WS2_32.DLL,NM,1, retrieves host information corresponding to a host namefrom a host database.Note The gethostbyname function has been deprecated by theintroduction of the getaddrinfo function.gethostbyname,WSOCK32.DLL,NM,1, retrieves host information corresponding to a host namefrom a host database.Note The gethostbyname function has been deprecated by theintroduction of the getaddrinfo function.gethostname,WS2_32.DLL,NM,2, retrieves the standard host name for the local computer.gethostname,WSOCK32.DLL,NM,2, retrieves the standard host name for the local computer.GetIconInfo,USER32.DLL,NM,2, retrieves information about the specified icon or cursor.GetImageConfigInformation,IMAGEHLP.DLL,NM,2, locates and returns the load configurationdata of an image.GetImageUnusedHeaderBytes,IMAGEHLP.DLL,NM,2, returns the offset and size of the part ofthe PE header that is currently unused.GetInputState,USER32.DLL,NM,0, determines whether there are mouse- button or keyboardmessages in the calling thread?s message queue.GetJob,WINMM.DLL,AW,6, retrieves print-job data for the specified printer.GetKBCodePage,USER32.DLL,NM,0 returns the current Windows code page.GetKernelObjectSecurity,ADVAPI32.DLL,NM,5, retrieves a copy of the security descriptorprotecting a kernel object.GetKerningPairs,GDI32.DLL,AW,3, retrieves the character-kerning pairs for the currentlyselected font for the specified device context.GetKeyboardLayout,USER32.DLL,NM,1, retrieves the active keyboard layout for a specifiedthread.GetKeyboardLayoutList,USER32.DLL,NM,2 retrieves the keyboard layouthandlescorresponding to the current set of input locales in thesystem.GetKeyboardLayoutName,USER32.DLL,AW,1, retrieves the name of the active keyboardlayout.GetKeyboardState,USER32.DLL,NM,1 copies the status of the 256 virtual keys to the specifiedbuffer.GetKeyboardType,USER32.DLL,NM,1, retrieves information about the current keyboard.GetKeyNameText,USER32.DLL,AW,3, retrieves a string that represents the name of a key.GetKeyState,USER32.DLL,NM,1, retrieves the status of the specified virtual key.GetLargestConsoleWindowSize,KERNEL32.DLL,NM,1 returns the size of thelargest possibleconsole window, based on the current font and thesize of the display.GetLastActivePopup,USER32.DLL,NM,1, determines which pop-up window owned by thespecified window was most recently active.GetLastError,KERNEL32.DLL,NM,0, returns the calling thread?s last-error code value.GetLengthSid,ADVAPI32.DLL,NM,1, returns the length, in bytes, of a valid SID structure.GetLocaleInfo,KERNEL32.DLL,AW,4, always retrieves information in text format.GetLocalTime,KERNEL32.DLL,NM,1 retrieves the current local date and time.GetLogicalDrives,KERNEL32.DLL,NM,0, returns a bitmask representing the currently availabledisk drives.GetLogicalDriveStrings,KERNEL32.DLL,AW,2, fills a buffer with strings that specify valid drivesin the system.GetMailslotInfo,KERNEL32.DLL,NM,5, retrieves information about the specified mailslot.GetMapMode,GDI32.DLL,NM,1 retrieves the current mapping mode.GetMappedFileName,PSAPI.DLL,AW,4, checks if the specified address is within a memory-mapped file in the address space of the specified process. If so, the function returns the nameof the memory-mapped file.GetMenu,USER32.DLL,NM,1, retrieves the handle of the menu assigned to the given window.GetMenuCheckMarkDimensions,USER32.DLL,NM,0, returns the dimensions of the defaultcheck mark bitmap.GetMenuContextHelpId,USER32.DLL,NM,1, retrieves the help context identifier associated withthe specified menu.GetMenuDefaultItem,USER32.DLL,NM,3 determines the default menu item on the specifiedmenu.GetMenuItemCount,USER32.DLL,NM,1, determines the number of items in the specified menu.GetMenuItemID,USER32.DLL,NM,2, retrieves the menu item identifier of a menu item locatedat the specified position in a menu.GetMenuItemInfo,USER32.DLL,AW,4, retrieves information about a menu item.GetMenuItemRect,USER32.DLL,NM,4, retrieves the bounding rectangle for the specified menuitem.GetMenuState,USER32.DLL,NM,3 retrieves the menu flags associated with the specified menuitem.GetMenuString,USER32.DLL,AW,5, copies the text string of the specified menu item into thespecified buffer.GetMessage,USER32.DLL,AW,4, retrieves a message from the calling thread?s messagequeue and places it in the specified structure.

GetMessageExtraInfo,USER32.DLL,NM,0, gets the extra message information for the currentthread.GetMessagePos,USER32.DLL,NM,0, returns a long value that gives the cursor position inscreen coordinates.GetMessageTime,USER32.DLL,NM,0 returns the message time for the lastmessage retrievedby the GetMessage function from the currentthread?s message queue.GetMetaFile,GDI32.DLL,AW,1, creates a handle that identifies the given Windows-formatmetafile.GetMetaFileBitsEx,GDI32.DLL,NM,3, retrieves the contents of a Windows- format metafile andcopies them into the specified buffer.GetMetaRgn,GDI32.DLL,NM,2, retrieves the current metaregion for the specified devicecontext.GetMiterLimit,GDI32.DLL,NM,2, returns the miter limit for the specified device context.GetModuleBaseName,PSAPI.DLL,AW,4, retrieves the base name of the specified module.GetModuleFileName,KERNEL32.DLL,AW,3, retrieves the full path and filename for theexecutable file containing the specified module.GetModuleFileNameEx,PSAPI.DLL,AW,4, retrieves the fully-qualified path for the file containingthe specified module.GetModuleHandle,KERNEL32.DLL,AW,1 returns a module handle for thespecified module ifthe file has been mapped into the address spaceof the calling process.GetModuleInformation,PSAPI.DLL,NM,4, retrieves information about the specified module inthe MODULEINFO structure.GetMonitorInfo,USER32.DLL,AW,2, lets you obtain information about a display monitor.GetMultipleTrustee,ADVAPI32.DLL,AW,1, is provided for future use.GetMultipleTrusteeOperation,ADVAPI32.DLL,AW,1, is provided for future use.GetNameByType,MSWSOCK.DLL,AW,3, obtains the name of a network service.GetNameByType,WSOCK32.DLL,AW,3, obtains the name of a network service.GetNamedPipeHandleState,KERNEL32.DLL,AW,7 GetNamedPipeHandleStatespecifiednamed pipe.GetNamedPipeInfo,KERNEL32.DLL,NM,5, retrieves information about the specified namedpipe.GetNamedSecurityInfo,ADVAPI32.DLL,AW,8, retrieves a copy of the security descriptor for anobject specified by name.GetNearestColor,GDI32.DLL,NM,2 returns a color value identifying acolor from the systempalette that will be displayed when thespecified color value is used.GetNearestPaletteIndex,GDI32.DLL,NM,2 retrieves the index for theentry in the specifiedlogical palette most closely matching aspecified color value.GetNextDlgGroupItem,USER32.DLL,NM,3 retrieves the handle of the firstcontrol in a group ofcontrols that precedes (or follows) thespecified control in a dialog box.GetNextDlgTabItem,USER32.DLL,NM,3 retrieves the handle of the firstcontrol that has theWS_TABSTOP style that precedes (or follows)the specified control.GetNtmsMediaPoolName,NTMSAPI.DLL,AW,4, retrieves the specified media pool's full namehierarchy.GetNtmsObjectAttribute,NTMSAPI.DLL,AW,6, retrieves the extended attribute (named privatedata) from the specified RSM object.GetNtmsObjectInformation,NTMSAPI.DLL,AW,3, returns an object's information structure forthe specified object.GetNtmsObjectSecurity,NTMSAPI.DLL,NM,7, reads the security descriptor for the specifiedRSM object.GetNtmsRequestOrder,NTMSAPI.DLL,NM,3, gets the order that the specified request will beprocessed in the library queue.GetNumberFormat,KERNEL32.DLL,AW,6, formats a number string as a number stringcustomized for a specified locale.GetNumberOfConsoleInputEvents,KERNEL32.DLL,NM,2, retrieves the number of unread inputrecords in the console?s input buffer.GetNumberOfConsoleMouseButtons,KERNEL32.DLL,NM,1, retrieves the number of buttons onthe mouse used by the current console.GetNumberOfEventLogRecords,ADVAPI32.DLL,NM,2 retrieves the number of records in thespecified event log.GetObject,GDI32.DLL,AW,3 obtains information about a specified graphics object.GetObjectType,GDI32.DLL,NM,1 identifies the type of the specified object.GetOEMCP,KERNEL32.DLL,NM,0, retrieves the current OEM code-page identifier for thesystem.GetOldestEventLogRecord,ADVAPI32.DLL,NM,2, retrieves the absolute record number of theoldest record in the specified event log.GetOpenClipboardWindow,USER32.DLL,NM,0, retrieves the handle of the window thatcurrently has the clipboard open.GetOpenFileName,COMDLG32.DLL,AW,1 creates an Open common dialog box thatlets theuser specify the drive, directory, and the name of a fileor set of files to open.GetOpenFileNamePreview,MSVFW32.DLL,AW,1, selects a file by using the Open dialog box.GetOutlineTextMetrics,GDI32.DLL,AW,3, retrieves text metrics for TrueType fonts.GetOverlappedResult,KERNEL32.DLL,NM,4 returns the results of anoverlapped operation onthe specified file, named pipe, orcommunications device.GetPaletteEntries,GDI32.DLL,NM,4, retrieves a specified range of palette entries from the givenlogical palette.GetParent,USER32.DLL,NM,1, retrieves the handle of the specified child window?s parentwindow.GetPath,GDI32.DLL,NM,4 retrieves the coordinates defining theendpoints of lines and thecontrol points of curves found in thepath that is selected into the specified device context.getpeername,WS2_32.DLL,NM,3 retrieves the name of thepeer to which a socket is connected.getpeername,WSOCK32.DLL,NM,3 retrieves the name of thepeer to which a socket isconnected.GetPixel,GDI32.DLL,NM,3, retrieves the red, green, blue (RGB) color value of the pixel at thespecified coordinates.GetPixelFormat,GDI32.DLL,NM,1, obtains the index of the currently selected pixel format of thespecified device context.GetPolyFillMode,GDI32.DLL,NM,1, retrieves the current polygon fill mode.GetPrinter,WINMM.DLL,AW,5, retrieves information about a specified printer.GetPrinterData,WINMM.DLL,AW,6, retrieves printer-configuration data for the specified printer.GetPrinterDriver,WINMM.DLL,AW,6, retrieves driver data for the specified printer.GetPrinterDriverDirectory,WINMM.DLL,AW,6, retrieves the path of the printer-driver directory.GetPrintProcessorDirectory,WINMM.DLL,AW,6, retrieves the path for the print processor on thespecified server.GetPriorityClass,KERNEL32.DLL,NM,1, returns the priority class for the specified process.GetPriorityClipboardFormat,USER32.DLL,NM,2, returns the first available clipboard format inthe specified list.GetPrivateObjectSecurity,ADVAPI32.DLL,NM,5 retrieves information from a protectedserverobject?s security descriptor.GetPrivateProfileInt,KERNEL32.DLL,AW,4 retrieves an integer associatedwith a key in thespecified section of the given initializationfile.GetPrivateProfileSection,KERNEL32.DLL,AW,4, retrieves all of the keys and values for thespecified section from an initialization file.GetPrivateProfileSectionNames,KERNEL32.DLL,AW,3, retrieves the names of all sections inan initialization file.GetPrivateProfileString,KERNEL32.DLL,AW,6, retrieves a string from the specified section inan initialization file.GetPrivateProfileStruct,KERNEL32.DLL,AW,5 retrieves the data associated with the specifiedkey in the given section of an initialization file.

Page 131: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

131GetProcAddress,KERNEL32.DLL,NM,2, returns the address of the specified exported dynamic-link library (DLL) function.GetProcessAffinityMask,KERNEL32.DLL,NM,3 obtains a process affinity mask for the specifiedprocess and the system affinity mask for the system.GetProcessHeap,KERNEL32.DLL,NM,0, obtains a handle to the heap of the calling process.GetProcessMemoryInfo,PSAPI.DLL,NM,3, retrieves information about the memory usage of thespecified process in the PROCESS_MEMORY_COUNTERS structure.GetProcessPriorityBoost,KERNEL32.DLL,NM,2, returns the priority boost control state of thespecified process.GetProcessShutdownParameters,KERNEL32.DLL,NM,2, retrieves shutdown parameters forthe currently calling process.GetProcessTimes,KERNEL32.DLL,NM,5, obtains timing information about a specified process.GetProcessVersion,KERNEL32.DLL,NM,1 obtains the major and minor versionnumbers of theWindows version on which a specified process expectsto run.GetProcessWindowStation,USER32.DLL,NM,0, returns a handle of the window stationassociated with the calling process.GetProcessWorkingSetSize,KERNEL32.DLL,NM,3, obtains the minimum and maximumworking set sizes of a specified process.GetProfileInt,KERNEL32.DLL,AW,3, retrieves an integer from the specified key name in thegiven section of the WIN.GetProfilesDirectory,USERENV.DLL,AW,2, retrieves the path to the root directory where alluser profiles are stored.GetProfileSection,KERNEL32.DLL,AW,3, retrieves all of the keys and values for the specifiedsection of the WIN.GetProfileString,KERNEL32.DLL,AW,5, retrieves the string associated with the specified key inthe given section of the WIN.GetProfileType,USERENV.DLL,NM,1, retrieves the type of profile loaded for the current user.GetProp,USER32.DLL,AW,2, retrieves a data handle from the property list of the given window.getprotobyname,WS2_32.DLL,NM,1 information corresponding to a protocol name.getprotobyname,WSOCK32.DLL,NM,1 information corresponding to a protocol name.getprotobynumber,WS2_32.DLL,NM,1 getprotobynumberretrieves protocolinformationcorresponding to a protocol number.getprotobynumber,WSOCK32.DLL,NM,1 retrieves protocolinformation corresponding to aprotocol number.GetPS2ColorRenderingDictionary,MSCMS.DLL,NM,5, retrieves the PostScript Level 2 colorrendering dictionary from the specified profile.GetPS2ColorRenderingIntent,MSCMS.DLL,NM,4, retrieves the PostScript Level 2 colorrendering intent from a profile.GetPS2ColorSpaceArray,MSCMS.DLL,NM,6, retrieves the PostScript Level 2 color space arrayfrom a profile.GetQueuedCompletionStatus,KERNEL32.DLL,NM,5, attempts to dequeue an I/O completionpacket from a specified input/output completion port.GetQueueStatus,USER32.DLL,NM,1, returns flags that indicate the type of messages found inthe calling thread?s message queue.GetRasterizerCaps,GDI32.DLL,NM,2, returns flags indicating whether TrueType fonts areinstalled in the system.GetRegionData,GDI32.DLL,NM,3, fills the specified buffer with data describing a region.GetRgnBox,GDI32.DLL,NM,2, retrieves the bounding rectangle of the specified region.GetROP2,GDI32.DLL,NM,1, retrieves the foreground mix mode of the specified device context.GetSaveFileName,COMDLG32.DLL,AW,1 creates a Save common dialog box that lets the userspecify the drive, directory, and name of a file to save.GetSaveFileNamePreview,MSVFW32.DLL,AW,1 selects a file by using the SaveAs dialog box.GetScrollInfo,USER32.DLL,NM,3 retrieves the parameters of a scrollbar, including the minimumand maximum scrolling positions, thepage size, and the position of the scroll box (thumb).GetScrollPos,USER32.DLL,NM,2, retrieves the current position of the scroll box (thumb) in thespecified scroll bar.GetScrollRange,USER32.DLL,NM,4 retrieves the current minimum and maximum scroll box(thumb) positions for the specified scroll barGetSecurityDescriptorControl,ADVAPI32.DLL,NM,3 retrieves a securitydescriptor?s controland revision information.GetSecurityDescriptorDacl,ADVAPI32.DLL,NM,4 retrieves a pointer to thediscretionary access-control list (ACL) in a specified securitydescriptor.GetSecurityDescriptorGroup,ADVAPI32.DLL,NM,3, retrieves the primary group informationfrom a security descriptor.GetSecurityDescriptorLength,ADVAPI32.DLL,NM,1, returns the length, in bytes, of a structurallyvalid SECURITY_DESCRIPTOR structure.GetSecurityDescriptorOwner,ADVAPI32.DLL,NM,3, retrieves the owner information from asecurity descriptor.GetSecurityDescriptorSacl,ADVAPI32.DLL,NM,4 retrieves a pointer to thesystem access-control list (ACL) in a specified securitydescriptor.GetSecurityInfo,ADVAPI32.DLL,NM,8 retrieves a copy of the security descriptor for an objectspecified by a handle.getservbyname,WS2_32.DLL,NM,2 getservbynameinformation corresponding to a servicename and protocol.getservbyname,WSOCK32.DLL,NM,2 information corresponding to a service name andprotocol.getservbyport,WS2_32.DLL,NM,2, retrieves service information corresponding to a port andprotocol.getservbyport,WSOCK32.DLL,NM,2, retrieves service information corresponding to a port andprotocol.GetService,MSWSOCK.DLL,AW,7,Important is a Microsoft-specific extension to the WindowsSockets 1.GetService,WSOCK32.DLL,AW,7,Important is a Microsoft-specific extension to the WindowsSockets 1.GetServiceDisplayName,ADVAPI32.DLL,AW,4 obtains the display name that is associated witha particular service. .GetServiceKeyName,ADVAPI32.DLL,AW,4, obtains the service name that is associated with aparticular service?s display name.GetShortPathName,KERNEL32.DLL,AW,3, obtains the short path form of a specified inputpath.GetSidIdentifierAuthority,ADVAPI32.DLL,NM,1 returns the address oftheSID_IDENTIFIER_AUTHORITY structure in a specified securityidentifier (SID).GetSidLengthRequired,ADVAPI32.DLL,NM,1 returns the length, in bytes, ofthe buffer requiredto store a SID structure with a specifiednumber of subauthorities.GetSidSubAuthority,ADVAPI32.DLL,NM,2, returns the address of a specified subauthority in aSID structure.GetSidSubAuthorityCount,ADVAPI32.DLL,NM,1, returns the address of the field in a SIDstructure containing the subauthority count.getsockname,WS2_32.DLL,NM,3, retrieves the current name for the specified socket descriptorin name.getsockname,WSOCK32.DLL,NM,3, retrieves the current name for the specified socketdescriptor in name.getsockopt,WS2_32.DLL,NM,5 retrieves a socket option.getsockopt,WSOCK32.DLL,NM,5 retrieves a socket option.GetStandardColorSpaceProfile,MSCMS.DLL,AW,4, retrieves the color profile registered for thespecified standard color space.GetStartupInfo,KERNEL32.DLL,AW,1 retrieves the contents of the STARTUPINFO structurethat was specified when the calling process was created.

GetStdHandle,KERNEL32.DLL,NM,1, returns a handle for the standard input, standard output,or standard error device.GetStockObject,GDI32.DLL,NM,1, retrieves a handle to one of the predefined stock pens,brushes, fonts, or palettes.GetStretchBltMode,GDI32.DLL,NM,1, retrieves the current stretching mode.GetStringType,KERNEL32.DLL,AW,5 returns character-type information for the characters inthe specified source string.GetStringTypeEx,KERNEL32.DLL,AW,5, returns character-type information for the charactersin the specified source string.GetSubMenu,USER32.DLL,NM,2, retrieves the handle of the drop-down menu or submenuactivated by the specified menu item.GetSysColor,USER32.DLL,NM,1, retrieves the current color of the specified display element.GetSysColorBrush,USER32.DLL,NM,1, retrieves a handle identifying a logical brush thatcorresponds to the specified color index.GetSystemDefaultLangID,KERNEL32.DLL,NM,0, retrieves the system default languageidentifier.GetSystemDefaultLCID,KERNEL32.DLL,NM,0, retrieves the system default locale identifier.GetSystemDirectory,KERNEL32.DLL,AW,2, retrieves the path of the Windows systemdirectory.GetSystemInfo,KERNEL32.DLL,NM,1, returns information about the current system.GetSystemMenu,USER32.DLL,NM,2 allows the application to access thewindow menu (alsoknown as the System menu or the Control menu) forcopying and modifying.GetSystemMetrics,USER32.DLL,NM,1, retrieves various system metrics and systemconfiguration settings.GetSystemPaletteEntries,GDI32.DLL,NM,4 retrieves a range of palette entries from the systempalette that is associated with the specified device context.GetSystemPaletteUse,GDI32.DLL,NM,1, retrieves the current state of the system (physical)palette for the specified device context.GetSystemPowerStatus,KERNEL32.DLL,NM,1 retrieves the power status of the system.GetSystemTime,KERNEL32.DLL,NM,1, retrieves the current system date and time.GetSystemTimeAdjustment,KERNEL32.DLL,NM,3 determines whether the system is applyingperiodic time adjustments to its time-of-day clock at each clock interrupt, along with the valueand period of any such adjustments.GetSystemTimeAsFileTime,KERNEL32.DLL,NM,1, obtains the current system date and time.GetTapeParameters,KERNEL32.DLL,NM,4, retrieves information that describes the tape or thetape drive.GetTapePosition,KERNEL32.DLL,NM,5, retrieves the current address of the tape, in logical orabsolute blocks.GetTapeStatus,KERNEL32.DLL,NM,1, indicates whether the tape device is ready to processtape commands.GetTempFileName,KERNEL32.DLL,AW,4, creates a name for a temporary file.GetTempPath,KERNEL32.DLL,AW,2, retrieves the path of the directory designated fortemporary files.GetTextAlign,GDI32.DLL,NM,1, retrieves the text the specified device context.GetTextCharacterExtra,GDI32.DLL,NM,1, retrieves the current intercharacter spacing for thespecified device context.GetTextCharset,GDI32.DLL,NM,1 obtains a character-set identifier forthe font that is currentlyselected into a specified devicecontext.GetTextColor,GDI32.DLL,NM,1, retrieves the current text color for the specified device context.GetTextExtentExPoint,GDI32.DLL,AW,7 retrieves the number of characters in a specified stringthat will fit within a specified space and fills an array with the text extent for each of thosecharacters.GetTextExtentPoint,GDI32.DLL,AW,4, computes the width and height of the specified string oftext.GetTextExtentPoint32,GDI32.DLL,AW,4, computes the width and height of the specified stringof text.GetTextFace,GDI32.DLL,AW,3, retrieves the typeface name of the font that is selected into thespecified device context.GetTextMetrics,GDI32.DLL,AW,2 fills the specified buffer with the,metrics for the currentlyselected font.GetThreadContext,KERNEL32.DLL,NM,2, retrieves the context of the specified thread.GetThreadDesktop,USER32.DLL,NM,1, returns a handle to the desktop associated with aspecified thread.GetThreadLocale,KERNEL32.DLL,NM,0, returns the calling thread?s current locale.GetThreadPriority,KERNEL32.DLL,NM,1, returns the priority value for the specified thread.GetThreadPriorityBoost,KERNEL32.DLL,NM,2, returns the priority boost control state of thespecified thread.GetThreadSelectorEntry,KERNEL32.DLL,NM,3, retrieves a descriptor table entry for thespecified selector and thread.GetThreadTimes,KERNEL32.DLL,NM,5, obtains timing information about a specified thread.GetTickCount,KERNEL32.DLL,NM,0 retrieves the number of milliseconds that have elapsedsince Windows was started.GetTimeFormat,KERNEL32.DLL,AW,6, formats a time as a time string for a specified locale.GetTimestampForLoadedLibrary,IMAGEHLP.DLL,NM,1, returns the timestamp of a loadedimage.GetTimeZoneInformation,KERNEL32.DLL,NM,1, retrieves the current time-zone parameters.GetTokenInformation,ADVAPI32.DLL,NM,5, retrieves a specified type of information about anaccess token.GetTopWindow,USER32.DLL,NM,1 examines the Z order of the child windows associated withthe specified parent window and retrieves the handle of the child window at the top of the Zorder.GetTrusteeName,ADVAPI32.DLL,AW,1, retrieves the trustee name from a TRUSTEE structure.GetTrusteeType,ADVAPI32.DLL,AW,1, retrieves the value assigned to the TrusteeTypemember of a specified TRUSTEE structure.GetTypeByName,MSWSOCK.DLL,AW,2,Important is a Microsoft-specific extension to theWindows Sockets 1.GetTypeByName,WSOCK32.DLL,AW,2,Important is a Microsoft-specific extension to theWindows Sockets 1.GetUpdateRect,USER32.DLL,NM,3 retrieves the coordinates of thesmallest rectangle thatcompletely encloses the update region ofthe specified window.GetUpdateRgn,USER32.DLL,NM,3, retrieves the update region of a window by copying it intothe specified region.GetUrlCacheEntryInfo,WININET.DLL,AW,3,Retrieves information about a cache entry.GetUrlCacheEntryInfoEx,WININET.DLL,AW,7,Retrieves information on the cache entryassociated with the specified URL, taking into account any redirections that are applied inoffline mode by the HttpSendRequest function.GetUrlCacheGroupAttribute,WININET.DLL,AW,7,Retrieves the attribute information of thespecified cache group.GetUserDefaultLangID,KERNEL32.DLL,NM,0 retrieves the user-default language identifier.GetUserDefaultLCID,KERNEL32.DLL,NM,0, retrieves the user-default locale identifier.GetUserName,ADVAPI32.DLL,AW,2, retrieves the user name of the current thread.GetUserNameEx,SECUR32.DLL,AW,3, retrieves the name of the user or other securityprincipal associated with the calling thread. You can specify the format of the returned name.GetUserObjectInformation,USER32.DLL,AW,5 returns information about awindow station ordesktop object.GetUserObjectSecurity,USER32.DLL,NM,5 retrieves security information for the specified userobject.GetUserProfileDirectory,USERENV.DLL,AW,3, retrieves the path to the root directory of thespecified user's profile.

Page 132: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

132GetVersion,KERNEL32.DLL,NM,0 returns the current version number of Windows andinformation about the operating system platform.GetViewportExtEx,GDI32.DLL,NM,2, retrieves the x-extents and y-extents of the currentviewport for the specified device context.GetViewportOrgEx,GDI32.DLL,NM,2 retrieves the x-coordinates and y-coordinates of theviewport origin for the specified devicecontext.GetVolumeInformation,KERNEL32.DLL,AW,8, returns information about a file system andvolume whose root directory is specified.GetWindow,USER32.DLL,NM,2, retrieves the handle of a window that has the specifiedrelationship (Z order or owner) to the specified window.GetWindowContextHelpId,USER32.DLL,NM,1, retrieves the help context identifier, if any,associated with the specified window.GetWindowDC,USER32.DLL,NM,1 retrieves the handle of a display device (DC)context for thespecified window.GetWindowExtEx,GDI32.DLL,NM,2 retrieves the x-extents and y-extents of the windowfor thespecified device context.GetWindowLong,USER32.DLL,AW,2, retrieves information about the specified window.GetWindowOrgEx,GDI32.DLL,NM,2, retrieves the x-coordinates and y- coordinates of thewindow origin for the specified device context.GetWindowPlacement,USER32.DLL,NM,2 retrieves the show state and therestored, minimized,and maximized positions of the specifiedwindow.GetWindowRect,USER32.DLL,NM,2, retrieves the dimensions of the bounding rectangle of thespecified window.GetWindowRgn,USER32.DLL,NM,2, obtains a copy of the window region of a window.GetWindowsDirectory,KERNEL32.DLL,AW,2, retrieves the path of the Windows directory.GetWindowText,USER32.DLL,AW,3, copies the text of the specified window? s title bar (if ithas one) into a buffer.GetWindowTextLength,USER32.DLL,AW,1 retrieves the length, incharacters, of the specifiedwindow?s title bar text (if the windowhas a title bar).GetWindowThreadProcessId,USER32.DLL,NM,2, retrieves the identifier of the thread thatcreated the specified window and, optionally, the identifier of the process that created thewindow.GetWindowWord,USER32.DLL,NM,2, is obsolete.GetWinMetaFileBits,GDI32.DLL,NM,5 converts the enhanced-formatrecords from a metafileinto Windows-format records and stores theconverted records in the specified buffer.GetWorldTransform,GDI32.DLL,NM,2, retrieves the current world-space to page-spacetransformation.GetWsChanges,PSAPI.DLL,NM,3, retrieves information about the pages that have been addedto the working set of the specified process since the InitializeProcessForWsWatch functioninitiated monitoring.glAccum,OPENGL.DLL,NM,2, operates on the accumulation buffer.glAccum,OPENGL32.DLL,NM,2, operates on the accumulation buffer.glAlphaFunc,OPENGL.DLL,NM,2, specifies the alpha test function.glAlphaFunc,OPENGL32.DLL,NM,2, specifies the alpha test function.glAreTexturesResident,OPENGL.DLL,NM,3, determines whether specified texture objects areresident.glAreTexturesResident,OPENGL32.DLL,NM,3, determines whether specified texture objectsare resident.glArrayElement,OPENGL.DLL,NM,1, specifies the array elements used to render a vertex.glArrayElement,OPENGL32.DLL,NM,1, specifies the array elements used to render a vertex.glBindTexture,OPENGL.DLL,NM,2, enables the creation of a named texture that is bound to atexture target.glBindTexture,OPENGL32.DLL,NM,2, enables the creation of a named texture that is bound toa texture target.glBitmap,OPENGL.DLL,NM,7, draws a bitmap.glBitmap,OPENGL32.DLL,NM,7, draws a bitmap.glBlendFunc,OPENGL.DLL,NM,2, specifies pixel arithmetic.glBlendFunc,OPENGL32.DLL,NM,2, specifies pixel arithmetic.glCallList,OPENGL.DLL,NM,1, executes a display list.glCallList,OPENGL32.DLL,NM,1, executes a display list.glCallLists,OPENGL.DLL,NM,3, executes a list of display lists.glCallLists,OPENGL32.DLL,NM,3, executes a list of display lists.glClear,OPENGL.DLL,NM,1, clears buffers to preset values.glClear,OPENGL32.DLL,NM,1, clears buffers to preset values.glClearAccum,OPENGL.DLL,NM,4, clears values for the accumulation buffer.glClearAccum,OPENGL32.DLL,NM,4, clears values for the accumulation buffer.glClearColor,OPENGL.DLL,NM,4, specifies clear values for the color buffers.glClearColor,OPENGL32.DLL,NM,4, specifies clear values for the color buffers.glClearDepth,OPENGL.DLL,NM,2, specifies the clear value for the depth buffer.glClearDepth,OPENGL32.DLL,NM,2, specifies the clear value for the depth buffer.glClearIndex,OPENGL.DLL,NM,1, specifies the clear value for the color- index buffers.glClearIndex,OPENGL32.DLL,NM,1, specifies the clear value for the color- index buffers.glClearStencil,OPENGL.DLL,NM,1, specifies the clear value for the stencil buffer.glClearStencil,OPENGL32.DLL,NM,1, specifies the clear value for the stencil buffer.glColor3b,OPENGL.DLL,NM,3 set the current colorglColor3b,OPENGL32.DLL,NM,3 set the current colorglColor3bv,OPENGL.DLL,NM,1 set the current colorglColor3bv,OPENGL32.DLL,NM,1 set the current colorglColor3d,OPENGL.DLL,NM,3 set the current colorglColor3d,OPENGL32.DLL,NM,3 set the current colorglColor3dv,OPENGL.DLL,NM,1 set the current colorglColor3dv,OPENGL32.DLL,NM,1 set the current colorglColor3f,OPENGL.DLL,NM,3 set the current colorglColor3f,OPENGL32.DLL,NM,3 set the current colorglColor3fv,OPENGL.DLL,NM,1 set the current colorglColor3fv,OPENGL32.DLL,NM,1 set the current colorglColor3i,OPENGL.DLL,NM,3 set the current colorglColor3i,OPENGL32.DLL,NM,3 set the current colorglColor3iv,OPENGL.DLL,NM,1 set the current colorglColor3iv,OPENGL32.DLL,NM,1 set the current colorglColor3s,OPENGL.DLL,NM,3 set the current colorglColor3s,OPENGL32.DLL,NM,3 set the current colorglColor3sv,OPENGL.DLL,NM,1 set the current colorglColor3sv,OPENGL32.DLL,NM,1 set the current colorglColor3ub,OPENGL.DLL,NM,3 set the current colorglColor3ub,OPENGL32.DLL,NM,3 set the current colorglColor3ubv,OPENGL.DLL,NM,1 set the current colorglColor3ubv,OPENGL32.DLL,NM,1 set the current colorglColor3ui,OPENGL.DLL,NM,3 set the current colorglColor3ui,OPENGL32.DLL,NM,3 set the current colorglColor3uiv,OPENGL.DLL,NM,1 set the current colorglColor3uiv,OPENGL32.DLL,NM,1 set the current colorglColor3us,OPENGL.DLL,NM,3 set the current colorglColor3us,OPENGL32.DLL,NM,3 set the current colorglColor3usv,OPENGL.DLL,NM,1 set the current colorglColor3usv,OPENGL32.DLL,NM,1 set the current colorglColor4b,OPENGL.DLL,NM,4 set the current colorglColor4b,OPENGL32.DLL,NM,4 set the current colorglColor4bv,OPENGL.DLL,NM,1 set the current color

glColor4bv,OPENGL32.DLL,NM,1 set the current colorglColor4d,OPENGL.DLL,NM,4 set the current colorglColor4d,OPENGL32.DLL,NM,4 set the current colorglColor4dv,OPENGL.DLL,NM,1 set the current colorglColor4dv,OPENGL32.DLL,NM,1 set the current colorglColor4f,OPENGL.DLL,NM,4 set the current colorglColor4f,OPENGL32.DLL,NM,4 set the current colorglColor4fv,OPENGL.DLL,NM,1 set the current colorglColor4fv,OPENGL32.DLL,NM,1 set the current colorglColor4i,OPENGL.DLL,NM,4 set the current colorglColor4i,OPENGL32.DLL,NM,4 set the current colorglColor4iv,OPENGL.DLL,NM,1 set the current colorglColor4iv,OPENGL32.DLL,NM,1 set the current colorglColor4s,OPENGL.DLL,NM,4 set the current colorglColor4s,OPENGL32.DLL,NM,4 set the current colorglColor4sv,OPENGL.DLL,NM,1 set the current colorglColor4sv,OPENGL32.DLL,NM,1 set the current colorglColor4ub,OPENGL.DLL,NM,4 set the current colorglColor4ub,OPENGL32.DLL,NM,4 set the current colorglColor4ubv,OPENGL.DLL,NM,1 set the current colorglColor4ubv,OPENGL32.DLL,NM,1 set the current colorglColor4ui,OPENGL.DLL,NM,4 set the current colorglColor4ui,OPENGL32.DLL,NM,4 set the current colorglColor4uiv,OPENGL.DLL,NM,1 set the current colorglColor4uiv,OPENGL32.DLL,NM,1 set the current colorglColor4us,OPENGL.DLL,NM,4 set the current colorglColor4us,OPENGL32.DLL,NM,4 set the current colorglColor4usv,OPENGL.DLL,NM,1 set the current colorglColor4usv,OPENGL32.DLL,NM,1 set the current colorglColorMask,OPENGL.DLL,NM,4, specifies whether the individual color components in theframe buffer can or cannot be written.glColorMask,OPENGL32.DLL,NM,4, specifies whether the individual color components in theframe buffer can or cannot be written.glColorMaterial,OPENGL.DLL,NM,2, causes a material color to track the current color.glColorMaterial,OPENGL32.DLL,NM,2, causes a material color to track the current color.glColorPointer,OPENGL.DLL,NM,4, defines an array of colors.glColorPointer,OPENGL32.DLL,NM,4, defines an array of colors.glCopyPixels,OPENGL.DLL,NM,5, copies pixels in the frame buffer.glCopyPixels,OPENGL32.DLL,NM,5, copies pixels in the frame buffer.glCopyTexImage1D,OPENGL.DLL,NM,7, copies pixels from the frame buffer into a one-dimensional texture image.glCopyTexImage1D,OPENGL32.DLL,NM,7, copies pixels from the frame buffer into a one-dimensional texture image.glCopyTexImage2D,OPENGL.DLL,NM,4, copies pixels from the frame buffer into a two-dimensional texture image.glCopyTexImage2D,OPENGL32.DLL,NM,4, copies pixels from the frame buffer into a two-dimensional texture image.glCopyTexSubImage1D,OPENGL.DLL,NM,3, copies a sub-image of a one- dimensional textureimage from the frame buffer.glCopyTexSubImage1D,OPENGL32.DLL,NM,3, copies a sub-image of a one- dimensionaltexture image from the frame buffer.glCopyTexSubImage2D,OPENGL.DLL,NM,4, copies a sub-image of a two- dimensional textureimage from the frame buffer.glCopyTexSubImage2D,OPENGL32.DLL,NM,4, copies a sub-image of a two- dimensionaltexture image from the frame buffer.glCullFace,OPENGL.DLL,NM,1, specifies whether front- or back-facing facets can be culled.glCullFace,OPENGL32.DLL,NM,1, specifies whether front- or back-facing facets can be culled.glDeleteLists,OPENGL.DLL,NM,2, deletes a contiguous group of display lists.glDeleteLists,OPENGL32.DLL,NM,2, deletes a contiguous group of display lists.glDeleteTextures,OPENGL.DLL,NM,2, deletes named textures.glDeleteTextures,OPENGL32.DLL,NM,2, deletes named textures.glDepthFunc,OPENGL.DLL,NM,1, specifies the value used for depth-buffer comparisons.glDepthFunc,OPENGL32.DLL,NM,1, specifies the value used for depth-buffer comparisons.glDepthMask,OPENGL.DLL,NM,1, enables or disables writing into the depth buffer.glDepthMask,OPENGL32.DLL,NM,1, enables or disables writing into the depth buffer.glDepthRange,OPENGL.DLL,NM,4, specifies the mapping of z values from normalized devicecoordinates to window coordinates.glDepthRange,OPENGL32.DLL,NM,4, specifies the mapping of z values from normalizeddevice coordinates to window coordinates.glDisable,OPENGL.DLL,NM,1 disable OpenGL capabilities.glDisable,OPENGL32.DLL,NM,1 disable OpenGL capabilities.glDisableClientState,OPENGL.DLL,NM,1 disable array.glDisableClientState,OPENGL32.DLL,NM,1 disable array.glDrawArrays,OPENGL.DLL,NM,3, specifies multiple primitives to render.glDrawArrays,OPENGL32.DLL,NM,3, specifies multiple primitives to render.glDrawBuffer,OPENGL.DLL,NM,1, specifies which color buffers are to be drawn into.glDrawBuffer,OPENGL32.DLL,NM,1, specifies which color buffers are to be drawn into.glDrawElements,OPENGL.DLL,NM,4, renders primitives from array data.glDrawElements,OPENGL32.DLL,NM,4, renders primitives from array data.glDrawPixels,OPENGL.DLL,NM,5, writes a block of pixels to the frame buffer.glDrawPixels,OPENGL32.DLL,NM,5, writes a block of pixels to the frame buffer.glEdgeFlag,OPENGL.DLL,NM,1 flag edges as either boundary or nonboundaryglEdgeFlag,OPENGL32.DLL,NM,1 flag edges as either boundary or nonboundaryglEdgeFlagPointer,OPENGL.DLL,NM,2, defines an array of edge flags.glEdgeFlagPointer,OPENGL32.DLL,NM,2, defines an array of edge flags.glEdgeFlagv,OPENGL.DLL,NM,1 flag edges as either boundary or nonboundaryglEdgeFlagv,OPENGL32.DLL,NM,1 flag edges as either boundary or nonboundaryglEnable,OPENGL.DLL,NM,1 enable OpenGL capabilities.glEnable,OPENGL32.DLL,NM,1 enable OpenGL capabilities.glEnableClientState,OPENGL.DLL,NM,1 enable array.glEnableClientState,OPENGL32.DLL,NM,1 enable array.glEnd,OPENGL.DLL,NM,0 delimit the vertices of a primitive or a group of like primitives.glEnd,OPENGL32.DLL,NM,0 delimit the vertices of a primitive or a group of like primitives.glEndList,OPENGL.DLL,NM,0 create or replace a display list.glEndList,OPENGL32.DLL,NM,0 create or replace a display list.glEvalCoord1d,OPENGL.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord1d,OPENGL32.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord1dv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1dv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1f,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1f,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1fv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1fv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2d,OPENGL.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2d,OPENGL32.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2dv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2dv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2f,OPENGL.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2f,OPENGL32.DLL,NM,2 evaluate enabled one- and two-dimensional maps.

Page 133: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

133glEvalCoord2fv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2fv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalMesh1,OPENGL.DLL,NM,3 compute a one- or two-dimensional grid of points or lines.glEvalMesh1,OPENGL32.DLL,NM,3 compute a one- or two-dimensional grid of points or lines.glEvalMesh2,OPENGL.DLL,NM,5 compute a one- or two-dimensional grid of points or lines.glEvalMesh2,OPENGL32.DLL,NM,5 compute a one- or two-dimensional grid of points or lines.glEvalPoint1,OPENGL.DLL,NM,1 generate and evaluate a single point in a mesh.glEvalPoint1,OPENGL32.DLL,NM,1 generate and evaluate a single point in a mesh.glEvalPoint2,OPENGL.DLL,NM,2 generate and evaluate a single point in a mesh.glEvalPoint2,OPENGL32.DLL,NM,2 generate and evaluate a single point in a mesh.glFeedbackBuffer,OPENGL.DLL,NM,3, controls feedback mode.glFeedbackBuffer,OPENGL32.DLL,NM,3, controls feedback mode.glFinish,OPENGL.DLL,NM,0, blocks until all OpenGL execution is complete.glFinish,OPENGL32.DLL,NM,0, blocks until all OpenGL execution is complete.glFlush,OPENGL.DLL,NM,0, forces execution of OpenGL functions in finite time.glFlush,OPENGL32.DLL,NM,0, forces execution of OpenGL functions in finite time.glFogf,OPENGL.DLL,NM,2 specify fog parameters.glFogf,OPENGL32.DLL,NM,2 specify fog parameters.glFogfv,OPENGL.DLL,NM,2 specify fog parameters.glFogfv,OPENGL32.DLL,NM,2 specify fog parameters.glFogi,OPENGL.DLL,NM,2 specify fog parameters.glFogi,OPENGL32.DLL,NM,2 specify fog parameters.glFogiv,OPENGL.DLL,NM,2 specify fog parameters.glFogiv,OPENGL32.DLL,NM,2 specify fog parameters.glFrontFace,OPENGL.DLL,NM,1, specifies which of the clockwise and counterclockwise facetsare front-facing and back-facing.glFrontFace,OPENGL32.DLL,NM,1, specifies which of the clockwise and counterclockwisefacets are front-facing and back-facing.glFrustum,OPENGL.DLL,NM,12, multiplies the current matrix by a perspective matrix.glFrustum,OPENGL32.DLL,NM,12, multiplies the current matrix by a perspective matrix.glGenLists,OPENGL.DLL,NM,1, generates a contiguous set of empty display lists.glGenLists,OPENGL32.DLL,NM,1, generates a contiguous set of empty display lists.glGenTextures,OPENGL.DLL,NM,2, generates texture names.glGenTextures,OPENGL32.DLL,NM,2, generates texture names.glGetBooleanv,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetBooleanv,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetClipPlane,OPENGL.DLL,NM,2, returns in equation the four coefficients of the planeequation for plane.glGetClipPlane,OPENGL32.DLL,NM,2, returns in equation the four coefficients of the planeequation for plane.glGetDoublev,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetDoublev,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetError,OPENGL.DLL,NM,0, returns error information.glGetError,OPENGL32.DLL,NM,0, returns error information.glGetFloatv,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetFloatv,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetIntegerv,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetIntegerv,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetLightfv,OPENGL.DLL,NM,3 return light source parameter values.glGetLightfv,OPENGL32.DLL,NM,3 return light source parameter values.glGetLightiv,OPENGL.DLL,NM,3 return light source parameter values.glGetLightiv,OPENGL32.DLL,NM,3 return light source parameter values.glGetMapdv,OPENGL.DLL,NM,3 return evaluator parameters.glGetMapdv,OPENGL32.DLL,NM,3 return evaluator parameters.glGetMapfv,OPENGL.DLL,NM,3 return evaluator parameters.glGetMapfv,OPENGL32.DLL,NM,3 return evaluator parameters.glGetMapiv,OPENGL.DLL,NM,3 return evaluator parameters.glGetMapiv,OPENGL32.DLL,NM,3 return evaluator parameters.glGetMaterialfv,OPENGL.DLL,NM,3 return material parameters.glGetMaterialfv,OPENGL32.DLL,NM,3 return material parameters.glGetMaterialiv,OPENGL.DLL,NM,3 return material parameters.glGetMaterialiv,OPENGL32.DLL,NM,3 return material parameters.glGetPixelMapfv,OPENGL.DLL,NM,2 return the specified pixel map.glGetPixelMapfv,OPENGL32.DLL,NM,2 return the specified pixel map.glGetPixelMapuiv,OPENGL.DLL,NM,2 return the specified pixel map.glGetPixelMapuiv,OPENGL32.DLL,NM,2 return the specified pixel map.glGetPixelMapusv,OPENGL.DLL,NM,2 return the specified pixel map.glGetPixelMapusv,OPENGL32.DLL,NM,2 return the specified pixel map.glGetPointerv,OPENGL.DLL,NM,2, returns the address of a vertex data array.glGetPointerv,OPENGL32.DLL,NM,2, returns the address of a vertex data array.glGetPolygonStipple,OPENGL.DLL,NM,1, returns the polygon stipple pattern.glGetPolygonStipple,OPENGL32.DLL,NM,1, returns the polygon stipple pattern.glGetString,OPENGL.DLL,NM,1, returns a string describing the current OpenGL connection.glGetString,OPENGL32.DLL,NM,1, returns a string describing the current OpenGL connection.glGetTexEnvfv,OPENGL.DLL,NM,3 return texture environment parameters.glGetTexEnvfv,OPENGL32.DLL,NM,3 return texture environment parameters.glGetTexEnviv,OPENGL.DLL,NM,3 return texture environment parameters.glGetTexEnviv,OPENGL32.DLL,NM,3 return texture environment parameters.glGetTexGendv,OPENGL.DLL,NM,3 return texture coordinate generation parameters.glGetTexGendv,OPENGL32.DLL,NM,3 return texture coordinate generation parameters.glGetTexGenfv,OPENGL.DLL,NM,3 return texture coordinate generation parameters.glGetTexGenfv,OPENGL32.DLL,NM,3 return texture coordinate generation parameters.glGetTexGeniv,OPENGL.DLL,NM,3 return texture coordinate generation parameters.glGetTexGeniv,OPENGL32.DLL,NM,3 return texture coordinate generation parameters.glGetTexImage,OPENGL.DLL,NM,5, returns a texture image.glGetTexImage,OPENGL32.DLL,NM,5, returns a texture image.glGetTexLevelParameterfv,OPENGL.DLL,NM,4 return texture parameter values for a specificlevel of detail.glGetTexLevelParameterfv,OPENGL32.DLL,NM,4 return texture parameter values for a specificlevel of detail.glGetTexLevelParameteriv,OPENGL.DLL,NM,4 return texture parameter values for a specificlevel of detail.glGetTexLevelParameteriv,OPENGL32.DLL,NM,4 return texture parameter values for a specificlevel of detail.glGetTexParameterfv,OPENGL.DLL,NM,3 return texture parameter values.glGetTexParameterfv,OPENGL32.DLL,NM,3 return texture parameter values.glGetTexParameteriv,OPENGL.DLL,NM,3 return texture parameter values.glGetTexParameteriv,OPENGL32.DLL,NM,3 return texture parameter values.glHint,OPENGL.DLL,NM,2, specifies implementation-specific hints.glHint,OPENGL32.DLL,NM,2, specifies implementation-specific hints.glIndexd,OPENGL.DLL,NM,2 set the current color index.glIndexd,OPENGL32.DLL,NM,2 set the current color index.glIndexdv,OPENGL.DLL,NM,1 set the current color index.glIndexdv,OPENGL32.DLL,NM,1 set the current color index.glIndexf,OPENGL.DLL,NM,1 set the current color index.glIndexf,OPENGL32.DLL,NM,1 set the current color index.glIndexfv,OPENGL.DLL,NM,1 set the current color index.glIndexfv,OPENGL32.DLL,NM,1 set the current color index.glIndexi,OPENGL.DLL,NM,1 set the current color index.

glIndexi,OPENGL32.DLL,NM,1 set the current color index.glIndexiv,OPENGL.DLL,NM,1 set the current color index.glIndexiv,OPENGL32.DLL,NM,1 set the current color index.glIndexMask,OPENGL.DLL,NM,1, controls the writing of individual bits in the color-indexbuffers.glIndexMask,OPENGL32.DLL,NM,1, controls the writing of individual bits in the color-indexbuffers.glIndexPointer,OPENGL.DLL,NM,3, defines an array of color indexes.glIndexPointer,OPENGL32.DLL,NM,3, defines an array of color indexes.glIndexs,OPENGL.DLL,NM,1 set the current color index.glIndexs,OPENGL32.DLL,NM,1 set the current color index.glIndexsv,OPENGL.DLL,NM,1 set the current color index.glIndexsv,OPENGL32.DLL,NM,1 set the current color index.glInitNames,OPENGL.DLL,NM,0, initializes the name stack.glInitNames,OPENGL32.DLL,NM,0, initializes the name stack.glInterleavedArrays,OPENGL.DLL,NM,3, simultaneously specifies and enables severalinterleaved arrays in a larger aggregate array.glInterleavedArrays,OPENGL32.DLL,NM,3, simultaneously specifies and enables severalinterleaved arrays in a larger aggregate array.glIsEnabled,OPENGL.DLL,NM,1 tests whether a capability is enabled.glIsEnabled,OPENGL32.DLL,NM,1 tests whether a capability is enabled.glIsList,OPENGL.DLL,NM,1 tests for display list existence.glIsList,OPENGL32.DLL,NM,1 tests for display list existence.glIsTexture,OPENGL.DLL,NM,1, determines if a name corresponds to a texture.glIsTexture,OPENGL32.DLL,NM,1, determines if a name corresponds to a texture.glLightf,OPENGL.DLL,NM,3 set light source parameters.glLightf,OPENGL32.DLL,NM,3 set light source parameters.glLightfv,OPENGL.DLL,NM,3 set light source parameters.glLightfv,OPENGL32.DLL,NM,3 set light source parameters.glLighti,OPENGL.DLL,NM,3 set light source parameters.glLighti,OPENGL32.DLL,NM,3 set light source parameters.glLightiv,OPENGL.DLL,NM,3 set light source parameters.glLightiv,OPENGL32.DLL,NM,3 set light source parameters.glLightModelf,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModelf,OPENGL32.DLL,NM,2 set the lighting model parameters.glLightModelfv,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModelfv,OPENGL32.DLL,NM,2 set the lighting model parameters.glLightModeli,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModeli,OPENGL32.DLL,NM,2 set the lighting model parameters.glLightModeliv,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModeliv,OPENGL32.DLL,NM,2 set the lighting model parameters.glLineStipple,OPENGL.DLL,NM,2, specifies the line stipple pattern.glLineStipple,OPENGL32.DLL,NM,2, specifies the line stipple pattern.glLineWidth,OPENGL.DLL,NM,1, specifies the width of rasterized lines.glLineWidth,OPENGL32.DLL,NM,1, specifies the width of rasterized lines.glListBase,OPENGL.DLL,NM,1, makes an additional level of indirection available.glListBase,OPENGL32.DLL,NM,1, makes an additional level of indirection available.glLoadIdentity,OPENGL.DLL,NM,0, replaces the current matrix with the identity matrix.glLoadIdentity,OPENGL32.DLL,NM,0, replaces the current matrix with the identity matrix.glLoadMatrixd,OPENGL.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadMatrixd,OPENGL32.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadMatrixf,OPENGL.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadMatrixf,OPENGL32.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadName,OPENGL.DLL,NM,1, loads a name onto the name stack.glLoadName,OPENGL32.DLL,NM,1, loads a name onto the name stack.glLogicOp,OPENGL.DLL,NM,1, specifies a logical pixel operation for color index rendering.glLogicOp,OPENGL32.DLL,NM,1, specifies a logical pixel operation for color index rendering.glMap1d,OPENGL.DLL,NM,4 define a one-dimensional evaluator.glMap1d,OPENGL32.DLL,NM,4 define a one-dimensional evaluator.glMap1f,OPENGL.DLL,NM,6 define a one-dimensional evaluator.glMap1f,OPENGL32.DLL,NM,6 define a one-dimensional evaluator.glMap2d,OPENGL.DLL,NM,7 define a two-dimensional evaluator.glMap2d,OPENGL32.DLL,NM,7 define a two-dimensional evaluator.glMap2f,OPENGL.DLL,NM,10 define a two-dimensional evaluator.glMap2f,OPENGL32.DLL,NM,10 define a two-dimensional evaluator.glMapGrid1d,OPENGL.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid1d,OPENGL32.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid1f,OPENGL.DLL,NM,3 define a one- or two-dimensional mesh.glMapGrid1f,OPENGL32.DLL,NM,3 define a one- or two-dimensional mesh.glMapGrid2d,OPENGL.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid2d,OPENGL32.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid2f,OPENGL.DLL,NM,6 define a one- or two-dimensional mesh.glMapGrid2f,OPENGL32.DLL,NM,6 define a one- or two-dimensional mesh.glMaterialf,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMaterialf,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMaterialfv,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMaterialfv,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMateriali,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMateriali,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMaterialiv,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMaterialiv,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMatrixMode,OPENGL.DLL,NM,1, sets the current matrix mode.glMatrixMode,OPENGL32.DLL,NM,1, sets the current matrix mode.glMultMatrixd,OPENGL.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glMultMatrixd,OPENGL32.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glMultMatrixf,OPENGL.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glMultMatrixf,OPENGL32.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glNewList,OPENGL.DLL,NM,2 create or replace a display list.glNewList,OPENGL32.DLL,NM,2 create or replace a display list.glNormal3b,OPENGL.DLL,NM,3 set the current normal vector.glNormal3b,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3bv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3bv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3d,OPENGL.DLL,NM,3 set the current normal vector.glNormal3d,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3dv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3dv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3f,OPENGL.DLL,NM,3 set the current normal vector.glNormal3f,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3fv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3fv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3i,OPENGL.DLL,NM,3 set the current normal vector.glNormal3i,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3iv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3iv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3s,OPENGL.DLL,NM,3 set the current normal vector.glNormal3s,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3sv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3sv,OPENGL32.DLL,NM,1 set the current normal vector.

Page 134: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

134glNormalPointer,OPENGL.DLL,NM,3, defines an array of normals.glNormalPointer,OPENGL32.DLL,NM,3, defines an array of normals.GlobalAddAtom,KERNEL32.DLL,AW,1 adds a character string to the globalatom table andreturns a unique value (an atom) identifying thestring.GlobalAlloc,KERNEL32.DLL,NM,2, allocates the specified number of bytes from the heap.GlobalCompact,KERNEL32.DLL,NM,1, is obsolete.GlobalDeleteAtom,KERNEL32.DLL,NM,1, decrements the reference count of a global stringatom.GlobalFindAtom,KERNEL32.DLL,AW,1 searches the global atom table for thespecifiedcharacter string and retrieves the global atom associatedwith that string.GlobalFix,KERNEL32.DLL,NM,1, is obsolete.GlobalFlags,KERNEL32.DLL,NM,1, returns information about the specified global memoryobject.GlobalFree,KERNEL32.DLL,NM,1, frees the specified global memory object and invalidates itshandle.GlobalGetAtomName,KERNEL32.DLL,AW,3, retrieves a copy of the character string associatedwith the specified global atom.GlobalHandle,KERNEL32.DLL,NM,1, retrieves the handle associated with the specified pointerto a global memory block.GlobalLock,KERNEL32.DLL,NM,1, locks a global memory object and returns a pointer to thefirst byte of the object?s memory block.GlobalMemoryStatus,KERNEL32.DLL,NM,1 obtains information about thecomputer system?scurrent usage of both physical and virtualmemory.GlobalReAlloc,KERNEL32.DLL,NM,3, changes the size or attributes of a specified globalmemory object.GlobalSize,KERNEL32.DLL,NM,1, retrieves the current size, in bytes, of the specified globalmemory object.GlobalUnfix,KERNEL32.DLL,NM,1, is obsolete.GlobalUnWire,KERNEL32.DLL,NM,1, is obsolete.GlobalWire,KERNEL32.DLL,NM,1 is obsolete.glOrtho,OPENGL.DLL,NM,12, multiplies the current matrix by an orthographic matrix.glOrtho,OPENGL32.DLL,NM,12, multiplies the current matrix by an orthographic matrix.glPassThrough,OPENGL.DLL,NM,1, places a marker in the feedback buffer.glPassThrough,OPENGL32.DLL,NM,1, places a marker in the feedback buffer.glPixelMapfv,OPENGL.DLL,NM,3 set up pixel transfer maps.glPixelMapfv,OPENGL32.DLL,NM,3 set up pixel transfer maps.glPixelMapuiv,OPENGL.DLL,NM,3 set up pixel transfer maps.glPixelMapuiv,OPENGL32.DLL,NM,3 set up pixel transfer maps.glPixelMapusv,OPENGL.DLL,NM,3 set up pixel transfer maps.glPixelMapusv,OPENGL32.DLL,NM,3 set up pixel transfer maps.glPixelStoref,OPENGL.DLL,NM,2, can be used to set any pixel store parameter.glPixelStoref,OPENGL32.DLL,NM,2, can be used to set any pixel store parameter.glPixelStorei,OPENGL.DLL,NM,2 set pixel storage modes.glPixelStorei,OPENGL32.DLL,NM,2 set pixel storage modes.glPixelTransferf,OPENGL.DLL,NM,2, can be used to set any pixel transfer parameter.glPixelTransferf,OPENGL32.DLL,NM,2, can be used to set any pixel transfer parameter.glPixelTransferi,OPENGL.DLL,NM,2 set pixel storage modes.glPixelTransferi,OPENGL32.DLL,NM,2 set pixel storage modes.glPixelZoom,OPENGL.DLL,NM,2, specifies values for the x and y zoom factors.glPixelZoom,OPENGL32.DLL,NM,2, specifies values for the x and y zoom factors.glPointSize,OPENGL.DLL,NM,1, specifies the diameter of rasterized points.glPointSize,OPENGL32.DLL,NM,1, specifies the diameter of rasterized points.glPolygonMode,OPENGL.DLL,NM,2, selects a polygon rasterization mode.glPolygonMode,OPENGL32.DLL,NM,2, selects a polygon rasterization mode.glPolygonStipple,OPENGL.DLL,NM,1, sets the polygon stippling pattern.glPolygonStipple,OPENGL32.DLL,NM,1, sets the polygon stippling pattern.glPopAttrib,OPENGL.DLL,NM,0, restores the values of the state variables saved with the lastglPushAttrib command.glPopAttrib,OPENGL32.DLL,NM,0, restores the values of the state variables saved with the lastglPushAttrib command.glPopClientAttrib,OPENGL.DLL,NM,0, restores the values of the client- state variables lastsaved with glPushClientAttrib.glPopClientAttrib,OPENGL32.DLL,NM,0, restores the values of the client- state variables lastsaved with glPushClientAttrib.glPopMatrix,OPENGL.DLL,NM,0 pop the current matrix stack.glPopMatrix,OPENGL32.DLL,NM,0 pop the current matrix stack.glPrioritizeTextures,OPENGL.DLL,NM,3, sets the residence priority of textures.glPrioritizeTextures,OPENGL32.DLL,NM,3, sets the residence priority of textures.glPushAttrib,OPENGL.DLL,NM,1, takes one argument, a mask that indicates which groups ofstate variables to save on the attribute stack.glPushAttrib,OPENGL32.DLL,NM,1, takes one argument, a mask that indicates which groups ofstate variables to save on the attribute stack.glPushClientAttrib,OPENGL.DLL,NM,1 save groups of client-state variables on the client-attribute stack.glPushClientAttrib,OPENGL32.DLL,NM,1 save groups of client-state variables on the client-attribute stack.glPushMatrix,OPENGL.DLL,NM,0, pushes the current matrix stack down by one, duplicatingthe current matrix.glPushMatrix,OPENGL32.DLL,NM,0, pushes the current matrix stack down by one, duplicatingthe current matrix.glPushName,OPENGL.DLL,NM,1, causes name to be pushed onto the name stack, which isinitially empty.glPushName,OPENGL32.DLL,NM,1, causes name to be pushed onto the name stack, which isinitially empty.glRasterPos2d,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2d,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2dv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2dv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2f,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2f,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2fv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2fv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2i,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2i,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2iv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2iv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2s,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2s,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2sv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2sv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3d,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3d,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3dv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3dv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3f,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3f,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3fv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3fv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3i,OPENGL.DLL,NM,3 specify the raster position for pixel operations.

glRasterPos3i,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3iv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3iv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3s,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3s,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3sv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3sv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4d,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4d,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4dv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4dv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4f,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4f,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4fv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4fv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4i,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4i,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4iv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4iv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4s,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4s,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4sv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4sv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glReadBuffer,OPENGL.DLL,NM,1, selects a color buffer source for pixels.glReadBuffer,OPENGL32.DLL,NM,1, selects a color buffer source for pixels.glReadPixels,OPENGL.DLL,NM,7, reads a block of pixels from the frame buffer.glReadPixels,OPENGL32.DLL,NM,7, reads a block of pixels from the frame buffer.glRectd,OPENGL.DLL,NM,4 draw a rectangle.glRectd,OPENGL32.DLL,NM,4 draw a rectangle.glRectdv,OPENGL.DLL,NM,2 draw a rectangle.glRectdv,OPENGL32.DLL,NM,2 draw a rectangle.glRectf,OPENGL.DLL,NM,4 draw a rectangle.glRectf,OPENGL32.DLL,NM,4 draw a rectangle.glRectfv,OPENGL.DLL,NM,2 draw a rectangle.glRectfv,OPENGL32.DLL,NM,2 draw a rectangle.glRecti,OPENGL.DLL,NM,4 draw a rectangle.glRecti,OPENGL32.DLL,NM,4 draw a rectangle.glRectiv,OPENGL.DLL,NM,2 draw a rectangle.glRectiv,OPENGL32.DLL,NM,2 draw a rectangle.glRects,OPENGL.DLL,NM,4 draw a rectangle.glRects,OPENGL32.DLL,NM,4 draw a rectangle.glRectsv,OPENGL.DLL,NM,2 draw a rectangle.glRectsv,OPENGL32.DLL,NM,2 draw a rectangle.glRenderMode,OPENGL.DLL,NM,1, sets the rasterization mode.glRenderMode,OPENGL32.DLL,NM,1, sets the rasterization mode.glRotated,OPENGL.DLL,NM,4 multiply the current matrix by a rotation matrix.glRotated,OPENGL32.DLL,NM,4 multiply the current matrix by a rotation matrix.glRotatef,OPENGL.DLL,NM,4 multiply the current matrix by a rotation matrix.glRotatef,OPENGL32.DLL,NM,4 multiply the current matrix by a rotation matrix.glScaled,OPENGL.DLL,NM,3 multiply the current matrix by a general scaling matrix.glScaled,OPENGL32.DLL,NM,3 multiply the current matrix by a rotation matrix.glScalef,OPENGL.DLL,NM,3 multiply the current matrix by a rotation matrix.glScalef,OPENGL32.DLL,NM,3 multiply the current matrix by a rotation matrix.glScissor,OPENGL.DLL,NM,4, defines the scissor box.glScissor,OPENGL32.DLL,NM,4, defines the scissor box.glSelectBuffer,OPENGL.DLL,NM,2, establishes a buffer for selection mode values.glSelectBuffer,OPENGL32.DLL,NM,2, establishes a buffer for selection mode values.glShadeModel,OPENGL.DLL,NM,1 selects flat or smooth shading.glShadeModel,OPENGL32.DLL,NM,1 selects flat or smooth shading.glStencilFunc,OPENGL.DLL,NM,3, sets the function and reference value for stencil testing.glStencilFunc,OPENGL32.DLL,NM,3, sets the function and reference value for stencil testing.glStencilMask,OPENGL.DLL,NM,1, controls the writing of individual bits in the stencil planes.glStencilMask,OPENGL32.DLL,NM,1, controls the writing of individual bits in the stencil planes.glStencilOp,OPENGL.DLL,NM,3, sets the stencil test actions.glStencilOp,OPENGL32.DLL,NM,3, sets the stencil test actions.glTexCoord1d,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord1d,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord1dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1f,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1f,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1i,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1i,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1s,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1s,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2d,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2d,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2f,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2f,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2i,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2i,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2s,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2s,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3d,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3d,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3f,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3f,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3i,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3i,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3iv,OPENGL32.DLL,NM,1 set the current texture coordinates.

Page 135: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

135glTexCoord3s,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3s,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4d,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4d,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4f,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4f,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4i,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4i,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4s,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4s,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoordPointer,OPENGL.DLL,NM,4, defines an array of texture coordinates.glTexCoordPointer,OPENGL32.DLL,NM,4, defines an array of texture coordinates.glTexEnvf,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnvf,OPENGL32.DLL,NM,3 set texture environment parameters.glTexEnvfv,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnvfv,OPENGL32.DLL,NM,3 set texture environment parameters.glTexEnvi,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnvi,OPENGL32.DLL,NM,3 set texture environment parameters.glTexEnviv,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnviv,OPENGL32.DLL,NM,3 set texture environment parameters.glTexGend,OPENGL.DLL,NM,2 control the generation of texture coordinates.glTexGend,OPENGL32.DLL,NM,2 control the generation of texture coordinates.glTexGendv,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGendv,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGenf,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGenf,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGenfv,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGenfv,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGeni,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGeni,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGeniv,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGeniv,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexImage1D,OPENGL.DLL,NM,4 specifies a one-dimensional texture image.glTexImage1D,OPENGL32.DLL,NM,4 specifies a one-dimensional texture image.glTexImage2D,OPENGL.DLL,NM,9, specifies a two-dimensional texture image.glTexImage2D,OPENGL32.DLL,NM,9, specifies a two-dimensional texture image.glTexParameterf,OPENGL.DLL,NM,3 set texture parameters.glTexParameterf,OPENGL32.DLL,NM,3 set texture parameters.glTexParameterfv,OPENGL.DLL,NM,3 set texture parameters.glTexParameterfv,OPENGL32.DLL,NM,3 set texture parameters.glTexParameteri,OPENGL.DLL,NM,3 set texture parameters.glTexParameteri,OPENGL32.DLL,NM,3 set texture parameters.glTexParameteriv,OPENGL.DLL,NM,3 set texture parameters.glTexParameteriv,OPENGL32.DLL,NM,3 set texture parameters.glTexSubImage1D,OPENGL.DLL,NM,7, specifies a portion of an existing one-dimensionaltexture image.glTexSubImage1D,OPENGL32.DLL,NM,7, specifies a portion of an existing one-dimensionaltexture image..glTexSubImage2D,OPENGL.DLL,NM,9, specifies a portion of an existing one-dimensionaltexture image.glTexSubImage2D,OPENGL32.DLL,NM,9, specifies a portion of an existing one-dimensionaltexture image.glTranslated,OPENGL.DLL,NM,3 multiply the current matrix by a translation matrix.glTranslated,OPENGL32.DLL,NM,3 multiply the current matrix by a translation matrix.glTranslatef,OPENGL.DLL,NM,3 multiply the current matrix by a translation matrix.glTranslatef,OPENGL32.DLL,NM,3 multiply the current matrix by a translation matrix.gluBeginCurve,GLU32.DLL,NM,1 delimit a NURBS curve definition.gluBeginPolygon,GLU32.DLL,NM,1 delimit a polygon description.gluBeginSurface,GLU32.DLL,NM,1 delimit a NURBS surface definition.gluBeginTrim,GLU32.DLL,NM,1 delimit a NURBS trimming loop definition.gluBuild1DMipmaps,GLU32.DLL,NM,6 creates 1-D mipmaps.gluBuild2DMipmaps,GLU32.DLL,NM,7, creates 2-D mipmaps.gluCylinder,GLU32.DLL,NM,9, draws a cylinder.gluDeleteNurbsRenderer,GLU32.DLL,NM,1, destroys a NURBS object.gluDeleteQuadric,GLU32.DLL,NM,1, destroys a quadric object.gluDeleteTess,GLU32.DLL,NM,1, destroys a tessellation object.gluDisk,GLU32.DLL,NM,7, draws a disk.gluEndCurve,GLU32.DLL,NM,1 delimit a NURBS curve definition.gluEndPolygon,GLU32.DLL,NM,1 delimit a polygon description.gluEndSurface,GLU32.DLL,NM,1 delimit a NURBS surface definition.gluEndTrim,GLU32.DLL,NM,1 delimit a NURBS trimming loop definition.gluErrorString,GLU32.DLL,NM,1 produces an error string from an OpenGL or GLU error code.gluGetNurbsProperty,GLU32.DLL,NM,3, gets a NURBS property.gluLoadSamplingMatrices,GLU32.DLL,NM,4, loads NURBS sampling and culling matrices.gluLookAt,GLU32.DLL,NM,18, defines a viewing transformation.gluNewNurbsRenderer,GLU32.DLL,NM,0, creates a NURBS object.gluNewQuadric,GLU32.DLL,NM,0, creates a quadric object.gluNewTess,GLU32.DLL,NM,0, creates a tessellation object.gluNextContour,GLU32.DLL,NM,2, marks the beginning of another contour.gluNurbsCallback,GLU32.DLL,NM,3, defines a callback for a NURBS object.gluNurbsCurve,GLU32.DLL,NM,7, defines the shape of a NURBS curve.gluNurbsProperty,GLU32.DLL,NM,3, sets a NURBS property.gluNurbsSurface,GLU32.DLL,NM,11, defines the shape of a NURBS surface.gluOrtho2D,GLU32.DLL,NM,8, defines a 2-D orthographic projection matrix.gluPartialDisk,GLU32.DLL,NM,11, draws an arc of a disk.gluPerspective,GLU32.DLL,NM,8, sets up a perspective projection matrix.gluPickMatrix,GLU32.DLL,NM,9, defines a picking region.gluProject,GLU32.DLL,NM,12, maps object coordinates to window coordinates.gluPwlCurve,GLU32.DLL,NM,5, describes a piecewise linear NURBS trimming curve.gluQuadricCallback,GLU32.DLL,NM,3, defines a callback for a quadric object.gluQuadricDrawStyle,GLU32.DLL,NM,2, specifies the draw style for quadrics rendered withqobj.gluQuadricNormals,GLU32.DLL,NM,2, specifies what kind of normals are to be used forquadrics.gluQuadricOrientation,GLU32.DLL,NM,2, specifies inside or outside orientation for quadrics.gluQuadricTexture,GLU32.DLL,NM,2, specifies whether quadrics are to be textured.gluScaleImage,GLU32.DLL,NM,9, scales an image to an arbitrary size.gluSphere,GLU32.DLL,NM,5, draws a sphere.gluTessCallback,GLU32.DLL,NM,3, defines a callback for a tessellation object.

gluTessVertex,GLU32.DLL,NM,3, describes a vertex on a polygon that the user is defining.gluUnProject,GLU32.DLL,NM,12, maps window coordinates to object coordinates.glVertex2d,OPENGL.DLL,NM,2 specify a vertex.glVertex2d,OPENGL32.DLL,NM,2 specify a vertex.glVertex2dv,OPENGL.DLL,NM,1 specify a vertex.glVertex2dv,OPENGL32.DLL,NM,1 specify a vertex.glVertex2f,OPENGL.DLL,NM,2 specify a vertex.glVertex2f,OPENGL32.DLL,NM,2 specify a vertex.glVertex2fv,OPENGL.DLL,NM,1 specify a vertex.glVertex2fv,OPENGL32.DLL,NM,1 specify a vertex.glVertex2i,OPENGL.DLL,NM,2 specify a vertex.glVertex2i,OPENGL32.DLL,NM,2 specify a vertex.glVertex2iv,OPENGL.DLL,NM,1 specify a vertex.glVertex2iv,OPENGL32.DLL,NM,1 specify a vertex.glVertex2s,OPENGL.DLL,NM,2 specify a vertex.glVertex2s,OPENGL32.DLL,NM,2 specify a vertex.glVertex2sv,OPENGL.DLL,NM,1 specify a vertex.glVertex2sv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3d,OPENGL.DLL,NM,3 specify a vertex.glVertex3d,OPENGL32.DLL,NM,3 specify a vertex.glVertex3dv,OPENGL.DLL,NM,1 specify a vertex.glVertex3dv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3f,OPENGL.DLL,NM,3 specify a vertex.glVertex3f,OPENGL32.DLL,NM,3 specify a vertex.glVertex3fv,OPENGL.DLL,NM,1 specify a vertex.glVertex3fv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3i,OPENGL.DLL,NM,3 specify a vertex.glVertex3i,OPENGL32.DLL,NM,3 specify a vertex.glVertex3iv,OPENGL.DLL,NM,1 specify a vertex.glVertex3iv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3s,OPENGL.DLL,NM,3 specify a vertex.glVertex3s,OPENGL32.DLL,NM,3 specify a vertex.glVertex3sv,OPENGL.DLL,NM,1 specify a vertex.glVertex3sv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4d,OPENGL.DLL,NM,4 specify a vertex.glVertex4d,OPENGL32.DLL,NM,4 specify a vertex.glVertex4dv,OPENGL.DLL,NM,1 specify a vertex.glVertex4dv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4f,OPENGL.DLL,NM,4 specify a vertex.glVertex4f,OPENGL32.DLL,NM,4 specify a vertex.glVertex4fv,OPENGL.DLL,NM,1 specify a vertex.glVertex4fv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4i,OPENGL.DLL,NM,4 specify a vertex.glVertex4i,OPENGL32.DLL,NM,4 specify a vertex.glVertex4iv,OPENGL.DLL,NM,1 specify a vertex.glVertex4iv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4s,OPENGL.DLL,NM,4 specify a vertex.glVertex4s,OPENGL32.DLL,NM,4 specify a vertex.glVertex4sv,OPENGL.DLL,NM,1 specify a vertex.glVertex4sv,OPENGL32.DLL,NM,1 specify a vertex.glVertexPointer,OPENGL.DLL,NM,4, defines an array of vertex data.glVertexPointer,OPENGL32.DLL,NM,4, defines an array of vertex data.glViewport,OPENGL.DLL,NM,4, sets the viewport.glViewport,OPENGL32.DLL,NM,4, sets the viewport.GopherCreateLocator,WININET.DLL,AW,7,Creates a Gopher or Gopher+ locator string fromthe selector string's component parts.GopherFindFirstFile,WININET.DLL,AW,6,Uses a Gopher locator and search criteria to create asession with the server and locate the requested documents, binary files, index servers, ordirectory trees.GopherGetAttribute,WININET.DLL,AW,8,Retrieves the specific attribute information from theserver.GopherGetLocatorType,WININET.DLL,AW,2,Parses a Gopher locator and determines itsattributes.GopherOpenFile,WININET.DLL,AW,5,Begins reading a Gopher data file from a Gopher server.GrayString,USER32.DLL,AW,9, draws gray text at the specified location.Heap32First,TOOLHELP.DLL,NM,3, retrieves information about the first block of a heap thathas been allocated by a process.Heap32ListFirst,TOOLHELP.DLL,NM,2, retrieves information about the first heap that has beenallocated by a specified process.Heap32ListNext,TOOLHELP.DLL,NM,2, retrieves information about the next heap that hasbeen allocated by a process.Heap32Next,TOOLHELP.DLL,NM,1, retrieves information about the next block of a heap thathas been allocated by a process.HeapAlloc,KERNEL32.DLL,NM,3, allocates a block of memory from a heap.HeapCompact,KERNEL32.DLL,NM,2, attempts to compact a specified heap.HeapCreate,KERNEL32.DLL,NM,3, creates a heap object that can be used by the callingprocess.HeapDestroy,KERNEL32.DLL,NM,1, destroys the specified heap object.HeapFree,KERNEL32.DLL,NM,3, frees a memory block allocated from a heap by theHeapAlloc or HeapReAlloc function.HeapLock,KERNEL32.DLL,NM,1, attempts to acquire the critical section object, or lock, that isassociated with a specified heap.HeapReAlloc,KERNEL32.DLL,NM,4, reallocates a block of memory from a heap.HeapSize,KERNEL32.DLL,NM,3, returns the size, in bytes, of a memory block allocated from aheap by the HeapAlloc or HeapReAlloc function.HeapUnlock,KERNEL32.DLL,NM,1, releases ownership of the critical section object, or lock,that is associated with a specified heap.HeapValidate,KERNEL32.DLL,NM,3, attempts to validate a specified heap.HeapWalk,KERNEL32.DLL,NM,2, enumerates the memory blocks in a specified heap.HexFromBin,MAPI32.DLL,NM,3, converts a binary number into a string representation of ahexadecimal number.HideCaret,USER32.DLL,NM,1, removes the caret from the screen.HiliteMenuItem,USER32.DLL,NM,4, highlights or removes the highlighting from an item in amenu bar.HlinkClone,HLINK.DLL,NM,5, HlinkClone Function Not currently supported.HlinkCreateBrowseContext,HLINK.DLL,NM,3, Creates an empty, default instance of the systembrowse context object.HlinkCreateExtensionServices,HLINK.DLL,NM,7, HlinkCreateExtensionServices Function Notcurrently supported.HlinkCreateFromData,HLINK.DLL,NM,6, Creates a standard hyperlink object from aComponent Object Model (COM) object that supports the IDataObject interface.HlinkCreateFromMoniker,HLINK.DLL,NM,8, Creates a new system hyperlink object from amoniker, a location string, and a friendly name string (used for displaying the hyperlink).HlinkCreateFromString,HLINK.DLL,NM,8, Creates a new hyperlink object from stringsrepresenting the hyperlink target, the location within the target, and a friendly name.HlinkCreateShortcut,HLINK.DLL,NM,6,FromString HlinkCreateShortcutFromString FunctionNot currently supported.HlinkCreateShortcutFromMoniker,HLINK.DLL,NM,7, HlinkCreateShortcutFromMoniker FunctionNot currently supported.

Page 136: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

136HlinkCreateShortcutFromString,HLINK.DLL,NM,7, HlinkCreateShortcutFromString FunctionNot currently supported.HlinkGetSpecialReference,HLINK.DLL,NM,2, Retrieves a string for a given value from theHLSR enumeration.HlinkGetValueFromParams,HLINK.DLL,NM,3, HlinkGetValueFromParams Function Notcurrently supported.HlinkGoBack,URLMON.DLL,NM,1, Executes a hyperlink jump backward within the navigationstack.HlinkGoForward,URLMON.DLL,NM,1, Executes a hyperlink jump forward within the navigationstack.HlinkIsShortcut,HLINK.DLL,NM,1, HlinkIsShortcut Function Not currently supported.HlinkNavigate,HLINK.DLL,NM,6,String Executes a hyperlink jump, specified by a string, to anew document or object. For information about how this function relates toHlinkSimpleNavigateToString, see the Remarks section.HlinkNavigateMoniker,URLMON.DLL,NM,2, Executes a hyperlink jump, specified by a moniker,to a new document or object. For information about how this function relates to theHlinkSimpleNavigateToMoniker function, see the Remarks section.HlinkNavigateString,URLMON.DLL,NM,2, Executes a hyperlink jump, specified by a string, to anew document or object. For information about how this function relates toHlinkSimpleNavigateToString, see the Remarks section.HlinkNavigateToStringReference,HLINK.DLL,NM,9, Creates a hyperlink site from stringsrepresenting the hyperlink target, the location within the target, and a friendly name, and thennavigates to that site.HlinkOnNavigate,HLINK.DLL,NM,7, Notifies a hyperlink browse context and hyperlink frame, ifit exists, that a hyperlink target has been navigated to.HlinkOnRenameDocument,HLINK.DLL,NM,4, HlinkOnRenameDocument Function Notcurrently supported.HlinkParseDisplayName,HLINK.DLL,NM,5, HlinkParseDisplayName Function Not currentlysupported.HlinkPreprocessMoniker,HLINK.DLL,NM,3, HlinkPreprocessMoniker Function Not currentlysupported.HlinkQueryCreateFromData,HLINK.DLL,NM,1, Determines if a new hyperlink can be createdfrom an IDataObject interface.HlinkResolveMonikerForData,HLINK.DLL,NM,7, HlinkResolveMonikerForData Function Notcurrently supported.HlinkResolveShortcut,HLINK.DLL,NM,6,ToString HlinkResolveShortcutToString Function Notcurrently supported.HlinkResolveShortcutToMoniker,HLINK.DLL,NM,3, HlinkResolveShortcutToMoniker FunctionNot currently supported.HlinkResolveShortcutToString,HLINK.DLL,NM,3, HlinkResolveShortcutToString Function Notcurrently supported.HlinkResolveStringForData,HLINK.DLL,NM,7, HlinkResolveStringForData Function Notcurrently supported.HlinkSetSpecialReference,HLINK.DLL,NM,2, Inserts a string into a specified member of theHLSR enumeration.HlinkSimpleNavigateToMoniker,URLMON.DLL,NM,8, Executes a hyperlink jump, specified by amoniker, to a new document or object. For information about how this function relates to theHlinkNavigateMoniker function, see the Remarks section.HlinkSimpleNavigateToString,URLMON.DLL,NM,8, Executes a hyperlink jump to a newdocument or object. For information about how this function relates to HlinkNavigateString, seethe Remarks section.HlinkTranslateURL,HLINK.DLL,NM,3, HlinkTranslateURL Function Not currently supported.HlinkUpdateStackItem,HLINK.DLL,NM,6, HlinkUpdateStackItem Function Not currentlysupported.HrAddColumns,MAPI32.DLL,NM,4 adds or moves columns to the beginning of an existingtable.HrAddColumnsEx,MAPI32.DLL,NM,5, adds or moves columns to the beginning of an existingtable.HrAllocAdviseSink,MAPI32.DLL,NM,3 creates an advise sink object, givena context specifiedby the calling implementation and a callbackfunction to be triggered by an event notification.HrBackupClose,EDBBCLI.DLL,NM,1, closes the file that is being backed up.HrBackupEnd,EDBBCLI.DLL,NM,1, cleans up after a backup operation is finished.HrBackupGetBackupLogs,EDBBCLI.DLL,AW,3, obtains the list of log files to back up.HrBackupGetDatabaseNames,EDBBCLI.DLL,AW,3, obtains the list of attached databases onthe remote computer.HrBackupOpenFile,EDBBCLI.DLL,AW,4 opens a remote file for backup and performs whateverclient and server side operations are necessary to prepare for the backup.HrBackupPrepare,EDBBCLI.DLL,AW,5, connects to a remote Microsoft Exchange Serverdatabase and prepares it for backup.HrBackupRead,EDBBCLI.DLL,NM,4, reads one block from a backup file.HrBackupTruncateLogs,EDBBCLI.DLL,NM,1, deletes the committed database log files.HrComposeEID,MAPI32.DLL,NM,7, creates a compound entry identifier for an object, usually amessage in a message store.HrComposeMsgID,MAPI32.DLL,NM,6 creates an ASCII string representing acompound entryidentifier for an object, usually a message in amessage store.HrDecomposeEID,MAPI32.DLL,NM,7 separates the compound entry identifier of an object,usually a message in a message store, into the entry identifier of that object within the store andthe store's entry identifier.HrDecomposeMsgID,MAPI32.DLL,NM,6 separates the ASCII representation of the compoundentry identifier of an object, usually a message in a message store, into the entry identifier ofthat object within the store and the store's entry identifier.HrDispatchNotifications,MAPI32.DLL,NM,1, forces dispatching of all queued notifications.HrEntryIDFromSz,MAPI32.DLL,NM,3, recreates an entry identifier from its ASCII encoding.HrGetOneProp,MAPI32.DLL,NM,3 retrieves the value of a single propertyfrom a propertyinterface, that is, an interface derived fromIMAPIProp.HrIStorageFromStream,MAPI32.DLL,NM,4, layers an IStorage interface onto an IStreamobject.HrQueryAllRows,MAPI32.DLL,NM,6 retrieves all rows of a table.HrRestoreEnd,EDBBCLI.DLL,NM,1, cleans up after a restore operation has been performed.HrRestoreGetDatabaseLocations,EDBBCLI.DLL,AW,3, obtains the database locations for theserver and service.HrRestorePrepare,EDBBCLI.DLL,AW,3, connects to a remote Microsoft Exchange Serverdatabase and prepares it for restore.HrRestoreRegister,EDBBCLI.DLL,AW,8 registers a restore operation, interlocking allsubsequent restore operations and preventing the restore target from starting untilHrRestoreRegisterComplete is called.HrRestoreRegisterComplete,EDBBCLI.DLL,NM,2 completes a restore operation, allowingsubsequent restore operations.HrSetCurrentBackupLog,EDBBCLI.DLL,AW,3, sets the last log number that was backed up.HrSetOneProp,MAPI32.DLL,NM,2, sets or changes the value of a single property on a propertyinterface, that is, an interface derived from IMAPIProp .HrSzFromEntryID,MAPI32.DLL,NM,3, encodes an entry identifier into an ASCII string.HrThisThreadAdviseSink,MAPI32.DLL,NM,2, creates an advise sink that wraps an existingadvise sink for thread safety.HrValidateIPMSubtree,MAPI32.DLL,NM,5, adds standard interpersonal message (IPM) foldersto a message store.htonl,WS2_32.DLL,NM,1 converts a u_long from host toTCP/IP network byte order.htonl,WSOCK32.DLL,NM,1 converts a u_long from host toTCP/IP network byte order.htons,WS2_32.DLL,NM,1 converts a u_short from host toTCP/IP network byte order.

htons,WSOCK32.DLL,NM,1 converts a u_short from host toTCP/IP network byte order.HttpAddRequestHeaders,WININET.DLL,AW,4,Adds one or more HTTP request headers to theHTTP request handle.HttpEndRequest,WININET.DLL,AW,4,Ends an HTTP request that was initiated byHttpSendRequestEx.HttpOpenRequest,WININET.DLL,AW,8,Creates an HTTP request handle.HttpQueryInfo,WININET.DLL,AW,5,Retrieves header information associated with an HTTPrequest.HttpSendRequest,WININET.DLL,AW,5,Sends the specified request to the HTTP server.HttpSendRequestEx,WININET.DLL,AW,5,Sends the specified request to the HTTP server.ICClose,MSVFW32.DLL,NM,1, closes a compressor or decompressor.ICCompressorChoose,MSVFW32.DLL,NM,6, displays a dialog box in which a user can select acompressor.ICCompressorFree,MSVFW32.DLL,NM,1, frees the resources in the COMPVARS structureused by other VCM functions.ICGetDisplayFormat,MSVFW32.DLL,NM,6, determines the best format available for displayinga compressed image.ICGetInfo,MSVFW32.DLL,NM,3, obtains information about a compressor.ICImageCompress,MSVFW32.DLL,NM,7, compresses an image to a given size.ICImageDecompress,MSVFW32.DLL,NM,5, decompresses an image without using initializationfunctions.ICInfo,MSVFW32.DLL,NM,3, retrieves information about specific installed compressors orenumerates the installed compressors.ICInstall,MSVFW32.DLL,NM,5, installs a new compressor or decompressor.ICLocate,MSVFW32.DLL,NM,5 finds a compressor or decompressor that can handle imageswith the specified formats, or finds a driver that can decompress an image with a specifiedformat directly to hardware.IcmpCloseHandle,ICMP.DLL,NM,1,closes a handle opened by a call to IcmpCreateFile.IcmpCreateFile,ICMP.DLL,NM,0, opens a handle on which ICMP Echo Requests can beissued.IcmpParseReplies,ICMP.DLL,NM,2, parses the reply buffer provided and returns the number ofICMP responses found.IcmpSendEcho,ICMP.DLL,NM,8,sends an ICMP Echo request and returns any replies.IcmpSendEcho2,ICMP.DLL,NM,11,sends an ICMP Echo request and returns eitherimmediately (if Event or ApcRoutine is non-NULL) or returns after the specified time-out.ICOpen,MSVFW32.DLL,NM,3, opens a compressor or decompressor.ICOpenFunction,MSVFW32.DLL,NM,4, opens a compressor or decompressor defined as afunction.ICRemove,MSVFW32.DLL,NM,3, removes an installed compressor.ICSendMessage,MSVFW32.DLL,NM,4, sends a message to a compressor.ICSeqCompressFrame,MSVFW32.DLL,NM,5, compresses one frame in a sequence of frames.ICSeqCompressFrameEnd,MSVFW32.DLL,NM,1 ends sequence compression thatwas initiatedby using the ICSeqCompressFrameStart andICSeqCompressFrame functions.ICSeqCompressFrameStart,MSVFW32.DLL,NM,2 initializes resources forcompressing asequence of frames using the ICSeqCompressFramefunction.IIDFromString,OLE32.DLL,NM,2,4.2 IIDFromString This function converts a string generatedby the function back into the original interface identifier (IID). WINOLEAPIImageAddCertificate,IMAGEHLP.DLL,NM,3, is used to add a certificate to the specified file.ImageDirectoryEntryToData,IMAGEHLP.DLL,NM,4, obtains access to image-specific data.ImageEnumerateCertificates,IMAGEHLP.DLL,NM,5, is used to return information about thecertificates currently contained in an image file.ImageGetCertificateData,IMAGEHLP.DLL,NM,4, is used to retrieve a complete certificate froma file.ImageGetCertificateHeader,IMAGEHLP.DLL,NM,3, is used to retrieve the header of thespecified certificate, up to, but not including, the section offset array.ImageGetDigestStream,IMAGEHLP.DLL,NM,5, retrieves the requested data from the specifiedimage file.ImagehlpApiVersion,IMAGEHLP.DLL,NM,0, retrieves the information about the version of thelibrary installed on the system.ImagehlpApiVersionEx,IMAGEHLP.DLL,NM,1, modifies the information about the version of thelibrary used by the application.ImageList_Add,COMCTL32.DLL,NM,3, adds an image or images to an image list.ImageList_AddIcon,COMCTL32.DLL,NM,2, adds an icon to an image list.ImageList_AddMasked,COMCTL32.DLL,NM,3, copies the bitmap to an internal data structure.ImageList_BeginDrag,COMCTL32.DLL,NM,4, begins dragging an image.ImageList_Create,COMCTL32.DLL,NM,5, creates a new image list.ImageList_Destroy,COMCTL32.DLL,NM,1, destroys an image list.ImageList_DragEnter,COMCTL32.DLL,NM,3 locks updates to the specifiedwindow during adrag operation and displays the drag image at thespecified position within the window.ImageList_DragLeave,COMCTL32.DLL,NM,1, unlocks the specified window and hides the dragimage, allowing the window to be updated.ImageList_DragMove,COMCTL32.DLL,NM,2, moves the image that is being dragged during adrag-and-drop operation.ImageList_DragShowNolock,COMCTL32.DLL,NM,1, shows or hides the image being dragged.ImageList_Draw,COMCTL32.DLL,NM,6, draws an image list item in the specified devicecontext.ImageList_DrawEx,COMCTL32.DLL,NM,10, draws an image list item in the specified devicecontext.ImageList_DrawIndirect,COMCTL32.DLL,NM,1,Draws an image list image based on anIMAGELISTDRAWPARAMS structureImageList_Duplicate,COMCTL32.DLL,NM,1,Creates a duplicate of an existing image list.ImageList_EndDrag,COMCTL32.DLL,NM,0, ends a drag operation.ImageList_GetBkColor,COMCTL32.DLL,NM,1, retrieves the current background color for animage list.ImageList_GetDragImage,COMCTL32.DLL,NM,2, retrieves the temporary image list that isused for the drag image.ImageList_GetIcon,COMCTL32.DLL,NM,3, creates an icon or cursor based on an image andmask in an image list.ImageList_GetIconSize,COMCTL32.DLL,NM,3, retrieves the dimensions of images in an imagelist.ImageList_GetImageCount,COMCTL32.DLL,NM,1, retrieves the number of images in an imagelist.ImageList_GetImageInfo,COMCTL32.DLL,NM,3, retrieves information about an image.ImageList_LoadImage,COMCTL32.DLL,AW,7 Creates an image list from the specified bitmap.ImageList_Merge,COMCTL32.DLL,NM,6, creates a new image by combining two existingimages.ImageList_Read,COMCTL32.DLL,NM,1, reads an image list from a stream.ImageList_Remove,COMCTL32.DLL,NM,2, removes an image from an image list.ImageList_Replace,COMCTL32.DLL,NM,4, replaces an image in an image list with a newimage.ImageList_ReplaceIcon,COMCTL32.DLL,NM,3, replaces an image with an icon.ImageList_SetBkColor,COMCTL32.DLL,NM,2, sets the background color for an image list.ImageList_SetDragCursorImage,COMCTL32.DLL,NM,4 creates a new drag imagebycombining the specified image (typically a mouse cursor image)with the current drag image.ImageList_SetIconSize,COMCTL32.DLL,NM,3, sets the dimensions of images in an image listand removes all images from the list.ImageList_SetImageCount,COMCTL32.DLL,NM,2,Resizes an existing image list.ImageList_SetOverlayImage,COMCTL32.DLL,NM,3, adds a specified image to the list ofimages to be used as overlay masks.

Page 137: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

137ImageList_Write,COMCTL32.DLL,NM,2, writes an image list to a stream.ImageLoad,IMAGEHLP.DLL,NM,2, maintains a list of loaded DLLs.ImageNtHeader,IMAGEHLP.DLL,NM,1, locates the IMAGE_NT_HEADERS structure in a PEimage and returns a pointer to the data.ImageRemoveCertificate,IMAGEHLP.DLL,NM,2, is used to remove the specified certificatefrom the given file.ImageRvaToSection,IMAGEHLP.DLL,NM,3, locates a relative virtual address (RVA) within theimage header of a file that is mapped as a file and returns a pointer to the section table entry forthat RVA.ImageRvaToVa,IMAGEHLP.DLL,NM,4, locates a relative virtual address (RVA) within theimage header of a file that is mapped as a file and returns the virtual address of thecorresponding byte in the file.ImageUnload,IMAGEHLP.DLL,NM,1, is used to deallocate resources from a previous call to theImageLoad function.ImmAssociateContext,IMM32.DLL,NM,2, associates the specified input context with thespecified window.ImmAssociateContextEx,IMM32.DLL,NM,3, changes the association between the input methodcontext and the specified window or its children.ImmConfigureIME,IMM32.DLL,AW,4, displays the configuration dialog box for the IME of thespecified input locale identifier (HKL).ImmCreateContext,IMM32.DLL,NM,0, creates a new input context, allocating memory for thecontext and initializing it.ImmCreateIMCC,IMM32.DLL,NM,1, (Windows CE .NET Application Development)This functionenables an input method editor (IME) to create a new input method context (IMC) componentthat is a member of an IMC. (Windows CE .NET 4.2)ImmDestroyContext,IMM32.DLL,NM,1, releases the input context and frees any memoryassociated with it.ImmDestroyIMCC,IMM32.DLL,NM,1, Handle to the IMC component.ImmDisableIME,IMM32.DLL,NM,1, disables the input method editor (IME) for a thread or allthreads in a process.ImmEnumInputContext,IMM32.DLL,NM,3, retrieves the input context for the specified thread.ImmEnumRegisterWord,IMM32.DLL,AW,6 enumerates the register strings having the specifiedreading string, style, and register string.ImmEscape,IMM32.DLL,AW,4, accesses capabilities of particular IMEs that are not availablethrough other IMM APIs. and is used mainly for country-specific operations.ImmGenerateMessage,IMM32.DLL,NM,1,This function enables an input method editor (IME) togenerate messages that are sent to the window associated with the input method context(IMC).ImmGetCandidateList,IMM32.DLL,AW,4, retrieves a specified candidate list, copying the list tothe specified buffer.ImmGetCandidateListCount,IMM32.DLL,AW,2 retrieves the size of the candidate lists.ImmGetCandidateWindow,IMM32.DLL,NM,3, gets information about the candidate list window.ImmGetCompositionFont,IMM32.DLL,AW,2 retrieves information about the logical fontcurrently used to display characters in the composition window.ImmGetCompositionString,IMM32.DLL,AW,4, retrieves information about the compositionstring.ImmGetCompositionWindow,IMM32.DLL,NM,2 retrieves information about the compositionwindow.ImmGetContext,IMM32.DLL,NM,1, retrieves the input context associated with the specifiedwindow.ImmGetConversionList,IMM32.DLL,AW,6, retrieves the conversion result list of characters orwords without generating any IME-related messages.ImmGetConversionStatus,IMM32.DLL,NM,3, gets the current conversion status.ImmGetDefaultIMEWnd,IMM32.DLL,NM,1, gets the default window handle to the IME class.ImmGetDescription,IMM32.DLL,AW,3, copies the description of the IME to the specified buffer.ImmGetGuideLine,IMM32.DLL,AW,4 retrieves information about errors.ImmGetHotKey,IMM32.DLL,NM,4, This function retrieves the value of the input method editor(IME) hot key.ImmGetIMCCLockCount,IMM32.DLL,NM,1, Handle to the IMC component.ImmGetIMCCSize,IMM32.DLL,NM,1, Handle to the IMC component.ImmGetIMCLockCount,IMM32.DLL,NM,1,This function enables an input method editor (IME) toget the lock count of the input method context (IMC).ImmGetIMEFileName,IMM32.DLL,AW,3, gets the filename of the IME associated with thespecified keyboard layout.ImmGetImeMenuItems,IMM32.DLL,AW,6, retrieves the menu items that are registered in theIME menu of a specified input context.ImmGetOpenStatus,IMM32.DLL,NM,1, checks whether the IME is open or closed.ImmGetProperty,IMM32.DLL,NM,2, gets the property and capabilities of the IME associatedwith the specified keyboard layout.ImmGetRegisterWordStyle,IMM32.DLL,AW,3, gets a list of the styles support by the IMEassociated with the specified keyboard layout.ImmGetStatusWindowPos,IMM32.DLL,NM,2, gets the position of the status window.ImmGetVirtualKey,IMM32.DLL,NM,1 recovers the original virtual-keyvalue associated with akey input message that has already beenprocessed by the IME.ImmInstallIME,IMM32.DLL,AW,2, installs an IME into the system.ImmIsIME,IMM32.DLL,NM,1, checks whether the specified handle identifies an IME.ImmIsUIMessage,IMM32.DLL,AW,4, checks for messages intended for the IME window andsends those messages to the specified window.ImmLockIMC,IMM32.DLL,NM,1,C This function enables an input method editor (IME) to get apointer to an input method context (IMC) component that can be a member of the IMC.ImmLockIMCC,IMM32.DLL,NM,1, This function enables an input method editor (IME) to get apointer to an input method context (IMC) component that can be a member of the IMC.ImmNotifyIME,IMM32.DLL,NM,4, notifies the IME about changes to the status of the inputcontext.ImmRegisterWord,IMM32.DLL,AW,4, registers a string into the dictionary of the IME associatedwith the specified input locale.ImmReleaseContext,IMM32.DLL,NM,2, releases the input context and unlocks the memoryassociated in the context.ImmReSizeIMCC,IMM32.DLL,NM,2,This function changes the size of an input method context(IMC) component.ImmSetCandidateWindow,IMM32.DLL,NM,2, sets information about the candidate list window.ImmSetCompositionFont,IMM32.DLL,AW,2, sets the logical font to be used to displaycharacters in the composition window.ImmSetCompositionString,IMM32.DLL,AW,6, sets the characters, attributes, and clauses of thecomposition and reading strings.ImmSetCompositionWindow,IMM32.DLL,NM,2, causes a IMN_SETSCOMPOSITIONWINDOWmessage to be sent to the application.ImmSetConversionStatus,IMM32.DLL,NM,3 sets the current conversion status.ImmSetHotKey,IMM32.DLL,NM,4,This function is called by the IME control panel application toset the value of the input method editor (IME) hot key.ImmSetOpenStatus,IMM32.DLL,NM,2, opens or closes the IME.ImmSetStatusWindowPos,IMM32.DLL,NM,2, sets the position of the status window.ImmSimulateHotKey,IMM32.DLL,NM,2 simulates the specified IME hot key,causing the sameresponse as if the user had pressed the hot key inthe specified window.ImmUnlockIMC,IMM32.DLL,NM,1, Handle to the IMC. (Windows CE .NET 4.2)ImmUnlockIMCC,IMM32.DLL,NM,1,This function reduces the lock count for the input methodcontext (IMC) component.ImmUnregisterWord,IMM32.DLL,AW,4 removes a register string from thedictionary of the IMEassociated with the specified keyboardlayout.

ImpersonateDdeClientWindow,USER32.DLL,NM,2 enables a Dynamic Data Exchange (DDE)server application to impersonate a DDE client application's security context.ImpersonateLoggedOnUser,ADVAPI32.DLL,NM,1, lets the calling thread impersonate a user.ImpersonateNamedPipeClient,ADVAPI32.DLL,NM,1, impersonates a named-pipe clientapplication.ImpersonateSecurityContext,SECUR32.DLL,NM,1,Allows a server to impersonate a client byusing a token previously obtained by a call to AcceptSecurityContext (General) orQuerySecurityContextToken.ImpersonateSelf,ADVAPI32.DLL,NM,1, obtains an access token that impersonates the securitycontext of the calling process.ImportNtmsDatabase,NTMSAPI.DLL,NM,1, causes RSM to import the database files from thedatabase Export directory at the next restart of the RSM.ImportSecurityContext,SECUR32.DLL,AW,4,Imports a security context. The security contextmust have been exported to the process calling ImportSecurityContext by a previous call toExportSecurityContext.InetIsOffline,URL.DLL,NM,1,Determines whether or not the system is connected to the Internet.inet_addr,WS2_32.DLL,NM,1, converts a string containing an (Ipv4) Internet Protocol dottedaddress into a proper address for the IN_ADDR structure.inet_addr,WSOCK32.DLL,NM,1, converts a string containing an (Ipv4) Internet Protocol dottedaddress into a proper address for the IN_ADDR structure.inet_ntoa,WS2_32.DLL,NM,1 converts an (Ipv4) Internet network address into a string inInternet standard dotted format.inet_ntoa,WSOCK32.DLL,NM,1 converts an (Ipv4) Internet network address into a string inInternet standard dotted format.InflateRect,USER32.DLL,NM,3, increases or decreases the width and height of the specifiedrectangle.InitAtomTable,KERNEL32.DLL,NM,1, initializes the local atom table and sets it to the specifiedsize.InitCommonControls,COMCTL32.DLL,NM,0 Registers and initializes the common controlwindow classes. This function is obsolete.InitCommonControlsEx,COMCTL32.DLL,NM,1,Registers specific common control classes fromthe common control dynamic-link libraryInitializeAcl,ADVAPI32.DLL,NM,3, creates a new ACL structure.InitializeCriticalSection,KERNEL32.DLL,NM,1, initializes a critical section object.InitializeFlatSB,COMCTL32.DLL,NM,1,Initializes flat scroll bars for a particular window.InitializeProcessForWsWatch,PSAPI.DLL,NM,1, initiates monitoring of the working set of thespecified process. You must call this function before calling the GetWsChanges function.InitializeSecurityContext,SECUR32.DLL,AW,12,Initiates the client side, outbound securitycontext from a credential handle by using the Negotiate security package.InitializeSecurityDescriptor,ADVAPI32.DLL,NM,2, initializes a new security descriptor.InitializeSid,ADVAPI32.DLL,NM,3 initializes a security identifier (SID).InitiateSystemShutdown,ADVAPI32.DLL,AW,5, displays a dialog box that notifies the user thatthe system is shutting down.InitSecurityInterface,SECUR32.DLL,AW,0, returns a pointer to an SSPI dispatch table. Thisfunction enables clients to use SSPI without binding directly to an implementation of theinterface.InjectNtmsCleaner,NTMSAPI.DLL,NM,5, allows a cleaner cartridge to be inserted into thespecified library unit.InjectNtmsMedia,NTMSAPI.DLL,NM,4, allows media to be inserted into the port of the specifiedlibrary. If the library is busy, RSM queues InjectNtmsMedia and returns success.InSendMessage,USER32.DLL,NM,0 specifies whether the current windowprocedure isprocessing a message that was sent from another threadby a call to the SendMessagefunction.InsertMenu,USER32.DLL,AW,5, inserts a new menu item into a menu, moving other itemsdown the menu.InsertMenuItem,USER32.DLL,AW,4, inserts a new menu item at the specified position in amenu.InstallColorProfile,MSCMS.DLL,AW,2, installs a given profile for use on a specified machine.The profile is also copied to the COLOR directory.InterlockedCompareExchange,KERNEL32.DLL,NM,3 performs an atomic comparison of thevalues specified in the Destination and Comperand parameters and exchange of the values,based on the outcome of the comparison.InterlockedDecrement,KERNEL32.DLL,NM,1 both decrements (decreases byone) the value ofthe specified 32-bit variable and checks theresulting value.InterlockedExchange,KERNEL32.DLL,NM,2, atomically exchanges a pair of 32- bit values.InterlockedExchangeAdd,KERNEL32.DLL,NM,2, performs an atomic addition of the Incrementvalue to the value pointed to by Addend.InterlockedIncrement,KERNEL32.DLL,NM,1 both increments (increases by one) the value ofthe specified 32-bit variable and checks the resulting value.InternetAttemptConnect,WININET.DLL,NM,1,Attempts to make a connection to the Internet.InternetAutodial,WININET.DLL,NM,2,Causes the modem to automatically dial the defaultInternet connection.InternetAutodialHangup,WININET.DLL,NM,1,Disconnects an automatic dial-up connection.InternetCanonicalizeUrl,WININET.DLL,AW,4,Canonicalizes a URL, which includes convertingunsafe characters and spaces into escape sequences.InternetCheckConnection,WININET.DLL,AW,3,Allows an application to check if a connection tothe Internet can be established.InternetCloseHandle,WININET.DLL,NM,1,Closes a single Internet handle.InternetCombineUrl,WININET.DLL,AW,5,Combines a base and relative URL into a single URL.The resultant URL is canonicalized (see InternetCanonicalizeUrl).InternetConfirmZoneCrossing,WININET.DLL,AW,4,Checks for changes between secure andnonsecure URLs. Always inform the user when a change occurs in security between two URLs.Typically, an application should allow the user to acknowledge the change through interactionwith a dialog box.InternetConnect,WININET.DLL,AW,8,Opens an File Transfer Protocol (FTP), Gopher, or HTTPsession for a given site.InternetCrackUrl,WININET.DLL,AW,4,Cracks a URL into its component parts.InternetCreateUrl,WININET.DLL,AW,4,Creates a URL from its component parts.InternetDial,WININET.DLL,NM,5,Initiates a connection to the Internet using a modem.InternetErrorDlg,WININET.DLL,NM,5,Displays a dialog box for the error that is passed toInternetErrorDlg, if an appropriate dialog box exists.InternetFindNextFile,WININET.DLL,AW,2,Continues a file search started as a result of aprevious call to FtpFindFirstFile or GopherFindFirstFile.InternetGetConnectedState,WININET.DLL,NM,2,Retrieves the connected state of the localsystem.InternetGetConnectedStateEx,WININET.DLL,NM,4,Retrieves the connected state of thespecified Internet connection.InternetGetCookie,WININET.DLL,AW,4,Retrieves the cookie for the specified URL.InternetGetLastResponseInfo,WININET.DLL,AW,3,Retrieves the last error description or serverresponse on the thread calling this function.InternetGoOnline,WININET.DLL,NM,3,Prompts the user for permission to initiate connection toa URL.InternetHangUp,WININET.DLL,NM,2,Instructs the modem to disconnect from the Internet.InternetLockRequestFile,WININET.DLL,NM,2,Places a lock on the file that is being used.InternetOpen,WININET.DLL,AW,5,Initializes an application's use of the WinINet functions.InternetOpenUrl,WININET.DLL,AW,6,Opens a resource specified by a complete FTP, Gopher,or HTTP URL.InternetQueryDataAvailable,WININET.DLL,NM,4,Queries the server to determine the amount ofdata available.

Page 138: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

138InternetQueryOption,WININET.DLL,AW,4,Queries an Internet option on the specified handle.InternetReadFile,WININET.DLL,NM,4,Reads data from a handle opened by theInternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest function.InternetReadFileEx,WININET.DLL,AW,4,Reads data from a handle opened by theInternetOpenUrl or HttpOpenRequest function.InternetSetCookie,WININET.DLL,AW,3,Creates a cookie associated with the specified URL.InternetSetDialState,WININET.DLL,NM,3,This function is obsolete. Do not use.InternetSetFilePointer,WININET.DLL,NM,5,Sets a file position for InternetReadFile. This is asynchronous call; however, subsequent calls to InternetReadFile might block or return pendingif the data is not available from the cache and the server does not support random access.InternetSetOption,WININET.DLL,AW,4,Sets an Internet option.InternetSetOptionEx,WININET.DLL,AW,5,Implemented only as a stub that calls theInternetSetOption function; InternetSetOptionEx has no functionality of its own. Do not use thisfunction at this time.InternetSetStatusCallback,WININET.DLL,AW,2,Sets up a callback function that WinINetfunctions can call as progress is made during an operation.InternetTimeFromSystemTime,WININET.DLL,AW,4,Formats a date and time according to theHTTP version 1.0 specification.InternetTimeToSystemTime,WININET.DLL,AW,3,Converts an HTTP time/date string to aSYSTEMTIME structure.InternetUnlockRequestFile,WININET.DLL,NM,1,Unlocks a file that was locked usingInternetLockRequestFile.InternetWriteFile,WININET.DLL,NM,4,Writes data to an open Internet file.IntersectClipRect,GDI32.DLL,NM,5 creates a new clipping region fromthe intersection of thecurrent clipping region and the specifiedrectangle.IntersectRect,USER32.DLL,NM,3 calculates the intersection of two source rectangles andplaces the coordinates of the intersection rectangle into the destination rectangle.InvalidateRect,USER32.DLL,NM,3, adds a rectangle to the specified window?s update region.InvalidateRgn,USER32.DLL,NM,3, invalidates the client area within the window.InventoryNtmsLibrary,NTMSAPI.DLL,NM,3, queues an inventory of the specified library. If thelibrary is busy, RSM queues InventoryNtmsLibrary and returns success.InvertRect,USER32.DLL,NM,2 inverts a rectangle in a window byperforming a logical NOToperation on the color values for eachpixel in the rectangle?s interior.InvertRgn,GDI32.DLL,NM,2, inverts the colors in the specified region.ioctlsocket,WS2_32.DLL,NM,3, can be used on any socket in any state.ioctlsocket,WSOCK32.DLL,NM,3, can be used on any socket in any state.IsAccelerator,OLE32.DLL,NM,4,Determines whether the keystroke maps to an accelerator inthe given accelerator table.IsAsyncMoniker,URLMON.DLL,NM,1, Tests to determine whether a moniker supportsasynchronous binding.IsBadCodePtr,KERNEL32.DLL,NM,1, determines whether the calling process has read accessto the memory at the specified address.IsBadHugeReadPtr,KERNEL32.DLL,NM,2, verifies that the calling process has read access tothe specified range of memory.IsBadHugeWritePtr,KERNEL32.DLL,NM,2, verifies that the calling process has write access tothe specified range of memory.IsBadReadPtr,KERNEL32.DLL,NM,2, verifies that the calling process has read access to thespecified range of memory.IsBadStringPtr,KERNEL32.DLL,AW,2, verifies that the calling process has read access to arange of memory pointed to by a string pointer.IsBadWritePtr,KERNEL32.DLL,NM,2, verifies that the calling process has write access to thespecified range of memory.IsCharAlpha,USER32.DLL,AW,1, determines whether a character is an alphabetic character.IsCharAlphaNumeric,USER32.DLL,AW,1, determines whether a character is either analphabetic or a numeric character.IsCharLower,USER32.DLL,AW,1, determines whether a character is lowercase.IsCharUpper,USER32.DLL,AW,1, determines whether a character is uppercase.IsChild,USER32.DLL,NM,2, tests whether a window is a child window or descendant window ofa specified parent window.IsClipboardFormatAvailable,USER32.DLL,NM,1, determines whether the clipboard containsdata in the specified format.IsColorProfileTagPresent,MSCMS.DLL,NM,3, reports whether a specified International ColorConsortium (ICC) tag is present in the specified color profile.IsColorProfileValid,MSCMS.DLL,NM,2, allows an application to determine whether the specifiedprofile is a valid International Color Consortium (ICC) profile that can be used for colormanagement.IsDBCSLeadByte,KERNEL32.DLL,NM,1 determines whether a character is alead byte / that is,the first byte of a character in a double-byte character set (DBCS).IsDBCSLeadByteEx,KERNEL32.DLL,NM,2 determines whether a character is alead byte / thatis, the first byte of a character in a double-byte character set (DBCS).IsDebuggerPresent,KERNEL32.DLL,NM,0, indicates whether the calling process is runningunder the context of a debugger.IsDialogMessage,USER32.DLL,AW,2 determines whether a message isintended for thespecified dialog box and, if it is, processes themessage.IsDlgButtonChecked,USER32.DLL,NM,2 determines whether a button control has a checkmark next to it or whether a three-state button control is grayed, checked, or neither.IsEqualGUID,OLE32.DLL,NM,2, GUID to compare to rguid2. rguid2 [in] GUID to compare torguid1.IsIconic,USER32.DLL,NM,1, determines whether the specified window is minimized (iconic).IsMenu,USER32.DLL,NM,1, determines whether a handle is a menu handle.IsProcessorFeaturePresent,KERNEL32.DLL,NM,1 determines whether thespecified processorfeature is supported by at least one processoron the current machine.IsRectEmpty,USER32.DLL,NM,1, determines whether the specified rectangle is empty.IsTextUnicode,ADVAPI32.DLL,NM,3, determines whether a buffer probably contains a form ofUnicode text.IsValidAcl,ADVAPI32.DLL,NM,1 validates an access-control list (ACL).IsValidCodePage,KERNEL32.DLL,NM,1 determines whether a specified code page isvalid.IsValidIid,OLE32.DLL,NM,1,4.2 IsValidIid This function is obsolete. Last updated onWednesday, April 13, 2005 B) 2005IsValidInterface,OLE32.DLL,NM,1,4.2 IsValidInterface This function is obsolete. Last updatedon Wednesday, April 13, 2005 B)IsValidLocale,KERNEL32.DLL,NM,2, applies a validity test to a locale identifier.IsValidPtrIn,OLE32.DLL,NM,2,4.2 IsValidPtrIn This function is obsolete. Last updated onWednesday, April 13, 2005 B) 2005IsValidPtrOut,OLE32.DLL,NM,2,4.2 IsValidPtrOut This function is obsolete.IsValidSecurityDescriptor,ADVAPI32.DLL,NM,1, determines whether the components of asecurity descriptor are valid.IsValidSid,ADVAPI32.DLL,NM,1 validates a SID structure by verifying thatthe revision numberis within a known range and that the number ofsubauthorities is less than the maximum.IsValidURL,URLMON.DLL,NM,3, Determines if a specified string is a valid URL.IsWindow,USER32.DLL,NM,1, determines whether the specified window handle identifies anexisting window.IsWindowEnabled,USER32.DLL,NM,1, determines whether the specified window is enabled formouse and keyboard input.IsWindowUnicode,USER32.DLL,NM,1, determines whether the specified window is a nativeUnicode window.IsWindowVisible,USER32.DLL,NM,1, retrieves the visibility state of the specified window.IsZoomed,USER32.DLL,NM,1, determines whether a window is maximized.joyGetDevCaps,WINMM.DLL,AW,3, queries a joystick to determine its capabilities.

joyGetNumDevs,WINMM.DLL,NM,0, queries the joystick driver for the number of joysticks itsupports.joyGetPos,WINMM.DLL,NM,2, queries a joystick for its position and button statusjoyGetPosEx,WINMM.DLL,NM,2, queries a joystick for its position and button status.joyGetThreshold,WINMM.DLL,NM,2, queries a joystick for its current movement threshold.joyReleaseCapture,WINMM.DLL,NM,1, releases the specified captured joystick.joySetCapture,WINMM.DLL,NM,4 captures a joystick by causing itsmessages to be sent to thespecified window.joySetThreshold,WINMM.DLL,NM,2, sets the movement threshold of a joystick.keybd_event,USER32.DLL,NM,4, synthesizes a keystroke.KillTimer,USER32.DLL,NM,2, destroys the specified timer.LaunchWizard,MAPI32.DLL,NM,5 Call LaunchWizard to add the MSEMS service.LBItemFromPt,COMCTL32.DLL,NM,4, retrieves the index of the item at the specified point in alist box.LCMapString,KERNEL32.DLL,AW,6, maps one character string to another, performing aspecified locale-dependent transformation.LeaveCriticalPolicySection,USERENV.DLL,NM,1, resumes the background application ofpolicy. This function closes the handle to the policy section.LeaveCriticalSection,KERNEL32.DLL,NM,1, releases ownership of the specified critical sectionobject.LHashValOfNameSys,OLEAUT32.DLL,AW,3,Computes a hash value for a name that can thenbe passed to ITypeComp::Bind, ITypeComp::BindType, ITypeLib::FindName, orlineAccept,TAPI32.DLL,NM,3, accepts the specified offered call.lineAddProvider,TAPI32.DLL,AW,3, installs a new telephony service provider into the telephonysystem.lineAddToConference,TAPI32.DLL,NM,2, adds the call specified by hConsultCall to theconference call specified by hConfCall.lineAgentSpecific,TAPI32.DLL,NM,5 allows the application to accessproprietary handler-specific functions of the agent handlerassociated with the address.lineAnswer,TAPI32.DLL,NM,3, answers the specified offering call.lineBlindTransfer,TAPI32.DLL,AW,3 performs a blind or single-steptransfer of the specified callto the specified destinationaddress.lineClose,TAPI32.DLL,NM,1, closes the specified open line device.lineCompleteCall,TAPI32.DLL,NM,4, specifies how a call that could not be connected normallyshould be completed instead.lineCompleteTransfer,TAPI32.DLL,NM,4, completes the transfer of the specified call to theparty connected in the consultation call.lineConfigDialog,TAPI32.DLL,AW,3 causes the provider of the specified line device to display adialog box (attached to hwndOwner of the application) to allow the user to configure parametersrelated to the line device.lineConfigDialogEdit,TAPI32.DLL,AW,6 causes the provider of the specified line device todisplay a dialog box (attached to hwndOwner of the application) to allow the user to configureparameters related to the line device.lineConfigProvider,TAPI32.DLL,NM,2, causes a service provider to display its configurationdialog box.LineDDA,GDI32.DLL,NM,6 determines which pixels should be highlighted for a line defined bythe specified starting and ending points.lineDeallocateCall,TAPI32.DLL,NM,1, deallocates the specified call handle.lineDevSpecific,TAPI32.DLL,NM,5, enables service providers to provide access to features notoffered by other TAPI functions.lineDevSpecificFeature,TAPI32.DLL,NM,4, enables service providers to provide access tofeatures not offered by other TAPI functions.lineDial,TAPI32.DLL,AW,3, dials the specified dialable number on the specified call.lineDrop,TAPI32.DLL,NM,3, drops or disconnects the specified call.lineForward,TAPI32.DLL,AW,7 forwards calls destined for the specified address on thespecified line, according to the specified forwarding instructions.lineGatherDigits,TAPI32.DLL,AW,7 initiates the buffered gathering of digits on the specified call.lineGenerateDigits,TAPI32.DLL,AW,4 initiates the generation of thespecified digits on thespecified call as inband tones using thespecified signaling mode.lineGenerateTone,TAPI32.DLL,NM,5, generates the specified inband tone over the specifiedcall.lineGetAddressCaps,TAPI32.DLL,AW,6, queries the specified address on the specified linedevice to determine its telephony capabilities.lineGetAddressID,TAPI32.DLL,AW,5 returns the address identifierassociated with an address ina different format on the specifiedline.lineGetAddressStatus,TAPI32.DLL,AW,3, allows an application to query the specified addressfor its current status.lineGetAgentActivityList,TAPI32.DLL,AW,3 obtains the identities of activities that the applicationcan select using lineSetAgentActivity to indicate what function the agent is actually performingat the moment.lineGetAgentCaps,TAPI32.DLL,AW,5, obtains the agent-related capabilities supported on thespecified line device.lineGetAgentGroupList,TAPI32.DLL,AW,3 obtains the identities of agent groups (combination ofqueue, supervisor, skill level, and so on) into which the agent currently logged in on theworkstation is permitted to log into on the automatic call distributor.lineGetAgentStatus,TAPI32.DLL,AW,3, obtains the agent-related status on the specifiedaddress.lineGetAppPriority,TAPI32.DLL,AW,6 allows an application to determine whether or not it is inthe handoff priority list for a particular media mode or Assisted Telephony request mode and, ifso, its position in the priority list.lineGetCallInfo,TAPI32.DLL,AW,2, enables an application to obtain fixed information about thespecified call.lineGetCallStatus,TAPI32.DLL,NM,2, returns the current status of the specified call.lineGetConfRelatedCalls,TAPI32.DLL,NM,2 returns a list of call handles that are part of thesame conference call as the specified call.lineGetCountry,TAPI32.DLL,AW,3 fetches the stored dialing rules and other information relatedto a specified country, the first country in the country list, or all countries.lineGetDevCaps,TAPI32.DLL,AW,5, queries a specified line device to determine its telephonycapabilities.lineGetDevConfig,TAPI32.DLL,AW,3 returns an "opaque" data structure object, the contents ofwhich are specific to the line (service provider) and device class.lineGetIcon,TAPI32.DLL,AW,3 allows an application to retrieve aservice line device-specific (orprovider-specific) icon fordisplay to the user.lineGetID,TAPI32.DLL,AW,6 returns a device identifier for thespecified device class associatedwith the selected line, address,or call.lineGetLineDevStatus,TAPI32.DLL,AW,2, enables an application to query the specified openline device for its current status.lineGetMessage,TAPI32.DLL,NM,3 returns the next TAPI message that is queued for deliveryto an application that is using the Event Handle notification mechanismlineGetNewCalls,TAPI32.DLL,NM,4 returns call handles to calls on aspecified line or addressfor which the application currently doesnot have handles.lineGetNumRings,TAPI32.DLL,NM,3 determines the number of rings anincoming call on thegiven address should ring prior to answeringthe call.lineGetProviderList,TAPI32.DLL,AW,2, returns a list of service providers currently installed inthe telephony system.lineGetRequest,TAPI32.DLL,AW,3, retrieves the next by-proxy request for the specified requestmode.

Page 139: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

139lineGetStatusMessages,TAPI32.DLL,NM,3 enables an application to query which notificationmessages the application is set up to receive for events related to status changes for thespecified line or any of its addresses.lineGetTranslateCaps,TAPI32.DLL,AW,3, returns address translation capabilities.lineHandoff,TAPI32.DLL,AW,3, gives ownership of the specified call to another application.lineHold,TAPI32.DLL,NM,1, places the specified call on hold.lineInitialize,TAPI32.DLL,NM,5, is obsolete.lineInitializeEx,TAPI32.DLL,AW,7, initializes the application's use of TAPI for subsequent use ofthe line abstraction.lineMonitorDigits,TAPI32.DLL,NM,2, enables and disables the unbuffered detection of digitsreceived on the call.lineMonitorTones,TAPI32.DLL,NM,3, enables and disables the detection of inband tones on thecall.lineNegotiateAPIVersion,TAPI32.DLL,NM,6, allows an application to negotiate an API versionto use.lineNegotiateExtVersion,TAPI32.DLL,NM,6 allows an application to negotiate an extensionversion to use with the specified line device.lineOpen,TAPI32.DLL,AW,9 opens the line device specified by its deviceidentifier and returns aline handle for the corresponding openedline device.linePark,TAPI32.DLL,AW,4, parks the specified call according to the specified park mode.linePickup,TAPI32.DLL,AW,5 picks up a call alerting at the specified destination address andreturns a call handle for the picked-up call.linePrepareAddToConference,TAPI32.DLL,AW,3, prepares an existing conference call for theaddition of another party.lineProxyMessage,TAPI32.DLL,NM,6, is used by a registered proxy request handler togenerate TAPI messages related to its role.lineProxyResponse,TAPI32.DLL,NM,3 used by a registered proxy request handler to generateTAPI messages related to its role.lineRedirect,TAPI32.DLL,AW,3, redirects the specified offering call to the specified destinationaddress.lineRegisterRequestRecipient,TAPI32.DLL,NM,4 registers the invokingapplication as a recipientof requests for the specified requestmode.lineReleaseUserUserInfo,TAPI32.DLL,NM,1 informs the service provider that the applicationhas processed the user-user information contained in the LINECALLINFO structure, and thatsubsequently received user-user information can now be written into that structure.lineRemoveFromConference,TAPI32.DLL,NM,1, removes the specified call from theconference call to which it currently belongs.lineRemoveProvider,TAPI32.DLL,NM,2, removes an existing telephony service provider fromthe telephony system.lineSecureCall,TAPI32.DLL,NM,1, secures the call from any interruptions or interference thatcan affect the call's media stream.lineSendUserUserInfo,TAPI32.DLL,NM,3, sends user-user information to the remote party onthe specified call.lineSetAgentActivity,TAPI32.DLL,NM,3, sets the agent activity code associated with a particularaddress.lineSetAgentGroup,TAPI32.DLL,NM,3, sets the agent groups into which the agent is logged intoon a particular address.lineSetAgentState,TAPI32.DLL,NM,4, sets the agent state associated with a particular address.lineSetAppPriority,TAPI32.DLL,AW,6 allows an application to set its priority in the handoffpriority list for a particular media mode or Assisted Telephony request mode, or to remove itselffrom the priority list.lineSetAppSpecific,TAPI32.DLL,NM,2 enables an application to set theapplication-specific fieldof the specified call's call-informationrecord.lineSetCallData,TAPI32.DLL,NM,3, sets the CallData member in LINECALLINFO.lineSetCallParams,TAPI32.DLL,NM,5 allows an application to change bearer mode and/or therate parameters of an existing call.lineSetCallPrivilege,TAPI32.DLL,NM,2, sets the application's privilege to the specified privilege.lineSetCallQualityOfService,TAPI32.DLL,NM,5 allows the application to attempt to change thequality of service parameters (reserved capacity and performance guarantees) for an existingcall.lineSetCallTreatment,TAPI32.DLL,NM,2, sets the sounds a party on a call that is unansweredor on hold hears.lineSetCurrentLocation,TAPI32.DLL,NM,2 sets the location used as the context for addresstranslation.lineSetDevConfig,TAPI32.DLL,AW,4 allows the application to restore the configuration of amedia stream device on a line device to a setup previously obtained using lineGetDevConfig .lineSetLineDevStatus,TAPI32.DLL,NM,3, sets the line device status.lineSetMediaControl,TAPI32.DLL,NM,12 enables and disables controlactions on the mediastream associated with the specified line,address, or call.lineSetMediaMode,TAPI32.DLL,NM,2, changes the call's media mode in its LINECALLINFOstructure.lineSetNumRings,TAPI32.DLL,NM,3, sets the number of rings that must occur before anincoming call is answered.lineSetTerminal,TAPI32.DLL,NM,7 enables an application to specifywhich terminal informationrelated to the specified line, address,or call is to be routed.lineSetTollList,TAPI32.DLL,AW,4, manipulates the toll list.lineSetupConference,TAPI32.DLL,AW,6, sets up a conference call for the addition of the thirdparty.lineSetupTransfer,TAPI32.DLL,AW,3, initiates a transfer of the call specified by the hCallparameter.lineShutdown,TAPI32.DLL,NM,1, shuts down the application's usage of the line abstraction ofthe API.lineSwapHold,TAPI32.DLL,NM,2, swaps the specified active call with the specified call onconsultation hold.LineTo,GDI32.DLL,NM,3, draws a line from the current position up to, but not including, thespecified point.lineTranslateAddress,TAPI32.DLL,AW,7, translates the specified address into another format.lineUncompleteCall,TAPI32.DLL,NM,2, cancels the specified call completion request on thespecified line.lineUnhold,TAPI32.DLL,NM,1, retrieves the specified held call.lineUnpark,TAPI32.DLL,AW,4, retrieves the call parked at the specified address and returns acall handle for it.listen,WS2_32.DLL,NM,2,WSAEINVAL was not invoked prior to accept.listen,WSOCK32.DLL,NM,2,WSAEINVAL was not invoked prior to accept.LoadAccelerators,USER32.DLL,AW,2, loads the specified accelerator table.LoadBitmap,USER32.DLL,AW,2, loads the specified bitmap resource from a module?sexecutable file.LoadCursor,USER32.DLL,AW,2, loads the specified cursor resource from the executable (.LoadCursorFromFile,USER32.DLL,AW,1, creates a cursor based on data contained in a file.LoadIcon,USER32.DLL,AW,2, can load only icons of these dimensions.LoadImage,USER32.DLL,AW,6, loads an icon, cursor, or bitmap.LoadKeyboardLayout,USER32.DLL,AW,2, loads a new keyboard layout into the system.LoadLibrary,KERNEL32.DLL,AW,1, maps the specified executable module into the addressspace of the calling process.LoadLibraryEx,KERNEL32.DLL,AW,3, maps a specified executable module into the addressspace of the calling process.LoadMenu,USER32.DLL,AW,2, loads the specified menu resource from the executable (.LoadMenuIndirect,USER32.DLL,AW,1, loads the specified menu template in memory.

LoadModule,KERNEL32.DLL,NM,2, loads and executes an application or creates a newinstance of an existing application.LoadPerfCounterTextStrings,LOADPERF.DLL,AW,2, loads performance objects and countersfrom the system that are identified by the specified initialization file.LoadRegTypeLib,OLEAUT32.DLL,NM,5,4.2 LoadRegTypeLib This function uses registryinformation to load a type library. HRESULT LoadRegTypeLib( REFGUID rguid, unsignedshortLoadResource,KERNEL32.DLL,NM,2, loads the specified resource into global memory.LoadString,USER32.DLL,AW,4 loads a string resource from the executablefile associated witha specified module, copies the string into abuffer, and appends a terminating null character.LoadTypeLib,OLEAUT32.DLL,NM,2,ExLoads a type library and (optionally) registers it in thesystem registry.LoadTypeLibEx,OLEAUT32.DLL,NM,3,Loads a type library and (optionally) registers it in thesystem registry.LoadUserProfile,USERENV.DLL,AW,2, loads the specified user's profile. The profile can be alocal user profile or a roaming user profile.LocalAlloc,KERNEL32.DLL,NM,2, allocates the specified number of bytes from the heap.LocalCompact,KERNEL32.DLL,NM,1, is obsolete.LocalFileTimeToFileTime,KERNEL32.DLL,NM,2 converts a local file time to a file time basedon the Coordinated Universal Time (UTC).LocalFlags,KERNEL32.DLL,NM,1 returns information about the specified local memory object.LocalFree,KERNEL32.DLL,NM,1, frees the specified local memory object and invalidates itshandle.LocalHandle,KERNEL32.DLL,NM,1 retrieves the handle associated with the specified pointer toa local memory object.LocalReAlloc,KERNEL32.DLL,NM,3, changes the size or the attributes of a specified localmemory object.LocalShrink,KERNEL32.DLL,NM,2, is obsolete.LocalSize,KERNEL32.DLL,NM,1, returns the current size, in bytes, of the specified localmemory object.LocalUnlock,KERNEL32.DLL,NM,1, unlocks it and decrements the lock count by one.LockFile,KERNEL32.DLL,NM,5, locks a region in an open file.LockFileEx,KERNEL32.DLL,NM,6, locks a byte range within an open file for shared or exclusiveaccess.LockResource,KERNEL32.DLL,NM,1, locks the specified resource in memory.LockServiceDatabase,ADVAPI32.DLL,NM,1, locks the specified service control managerdatabase.LockWindowUpdate,USER32.DLL,NM,1, disables or reenables drawing in the specifiedwindow.LogonUser,ADVAPI32.DLL,AW,6, attempts to log a user on to the local was called.LookupAccountName,ADVAPI32.DLL,AW,7, accepts the name of a system and an account asinput.LookupAccountSid,ADVAPI32.DLL,AW,7, accepts a security identifier (SID) as input.LookupIconIdFromDirectory,USER32.DLL,NM,2, searches through icon or cursor data for theicon or cursor that best fits the current display device.LookupIconIdFromDirectoryEx,USER32.DLL,NM,5 searches through icon or cursor data for theicon or cursor that best fits the current display device.LookupPrivilegeDisplayName,ADVAPI32.DLL,AW,5, retrieves a displayable name representinga specified privilege.LookupPrivilegeName,ADVAPI32.DLL,AW,4 retrieves the name correspondingto the privilegerepresented on a specific system by a specifiedlocally unique identifier (LUID).LookupPrivilegeValue,ADVAPI32.DLL,AW,3 retrieves the locally unique identifier (LUID) usedon a specified system to locally represent the specified privilege name.LookupSecurityDescriptorParts,ADVAPI32.DLL,AW,7, retrieves security information from a self-relative security descriptor.LPropCompareProp,MAPI32.DLL,NM,2, compares two property values to determine if they areequal.LPtoDP,GDI32.DLL,NM,3, converts logical coordinates into device coordinates.LsaCallAuthenticationPackage,SECUR32.DLL,NM,7,Used by a logon application tocommunicate with an authentication package.LsaConnectUntrusted,SECUR32.DLL,NM,1,Establishes an untrusted connection to the LSAserver.LsaDeregisterLogonProcess,SECUR32.DLL,NM,1,Deletes the caller's logon application contextand closes the connection to the LSA server.LsaFreeReturnBuffer,SECUR32.DLL,NM,1,Frees the memory used by a buffer previouslyallocated by the LSA.LsaLogonUser,SECUR32.DLL,NM,14,Authenticates a security principal's logon data usingstored credentials information.LsaLookupAuthenticationPackage,SECUR32.DLL,NM,3,Obtains the unique identifier of anauthentication package.LsaRegisterLogonProcess,SECUR32.DLL,NM,3,Establishes a connection to the LSA serverand verifies that the caller is a logon application.LsaRegisterPolicyChangeNotification,SECUR32.DLL,NM,2, registers an event handle with thelocal security authority (LSA). This event handle is signaled whenever the indicated LSA policyis modified.LsaUnregisterPolicyChangeNotification,SECUR32.DLL,NM,2, disables a previously registerednotification event.LSEnumProviders,LSAPI32.DLL,NM,2, returns a unique string for each installed license systemservice provider.LSEnumProviders,MSLSP32.DLL,NM,2, returns a unique string for each installed licensesystem service provider.LSFreeHandle,LSAPI32.DLL,NM,1, frees the licensing handle context.LSFreeHandle,MSLSP32.DLL,NM,1, frees the licensing handle context.LSQuery,LSAPI32.DLL,NM,5 returns information about the service provider or the licensesystem context associated with the specified handle obtained by a call to the LSRequestfunction.LSQuery,MSLSP32.DLL,NM,5 returns information about the service provider or the licensesystem context associated with the specified handle obtained by a call to the LSRequestfunction.LSRelease,LSAPI32.DLL,NM,3 requests the license system release.LSRelease,MSLSP32.DLL,NM,3 requests that the license system release theNotice:besupported in future releases of Microsoft Windows.LSRequest,LSAPI32.DLL,NM,9, asks that the license system grant the licensing resources sothe calling application can execute.LSRequest,MSLSP32.DLL,NM,9, asks that the license system grant the licensing resources sothe calling application can execute.lstrcat,KERNEL32.DLL,AW,2, appends one string to another.lstrcmp,KERNEL32.DLL,AW,2, compares two character strings.lstrcmpi,KERNEL32.DLL,AW,2, compares two character strings.lstrcpy,KERNEL32.DLL,AW,2, copies a string to a buffer.lstrcpyn,KERNEL32.DLL,AW,3, copies a specified number of characters from a source stringinto a buffer.lstrlen,KERNEL32.DLL,AW,1 returns the length in bytes (ANSI version) orcharacters (Unicodeversion) of the specified string (not includingthe terminating null character).LSUpdate,LSAPI32.DLL,NM,6, updates the synchronization between the licensed applicationsoftware and the license system.LSUpdate,MSLSP32.DLL,NM,6, updates the synchronization between the licensed applicationsoftware and the license system.LZClose,LZ32.DLL,NM,1 closes a file that was opened by using the LZOpenFile function.

Page 140: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

140LZCopy,LZ32.DLL,NM,2, copies a source file to a destination file.LZDone,LZ32.DLL,NM,0 is obsolete.LZInit,LZ32.DLL,NM,1 allocates memory for the internal datastructures required to decompressfiles, and then creates andinitializes them.LZOpenFile,LZ32.DLL,AW,3 creates, opens, reopens, or deletes the specified file.LZRead,LZ32.DLL,NM,3, reads (at most) the specified number of bytes from a file and copiesthem into a buffer.LZSeek,LZ32.DLL,NM,3, moves a file pointer a number of bytes from a starting position.LZStart,LZ32.DLL,NM,0 is obsolete.MakeAbsoluteSD,ADVAPI32.DLL,NM,11 creates a security descriptor inabsolute format byusing a security descriptor in self-relativeformat as a template.MakeDragList,COMCTL32.DLL,NM,1, changes the specified single-selection list box to a draglist box.MakeSelfRelativeSD,ADVAPI32.DLL,NM,3 creates a security descriptor inself-relative formatby using a security descriptor in absoluteformat as a template.MakeSignature,SECUR32.DLL,NM,4,Generates a cryptographic checksum of the message,and also includes sequencing information to prevent message loss or insertion.MakeSureDirectoryPathExists,IMAGEHLP.DLL,NM,1, creates all the directories in the specifiedDirPath, beginning with the root.MapAndLoad,IMAGEHLP.DLL,NM,5, maps an image and preloads data from the mapped file.MapDebugInformation,IMAGEHLP.DLL,NM,4, gains access to the debugging information for animage.MapDialogRect,USER32.DLL,NM,2, converts (maps) the specified dialog box units to screenunits (pixels).MapFileAndCheckSum,IMAGEHLP.DLL,AW,3, computes the checksum of the specified file.MapGenericMask,ADVAPI32.DLL,NM,2 maps the generic access rights in an access mask tospecific and standard access rights.MAPIAdminProfiles,MAPI32.DLL,NM,2, creates a profile administration object.MAPIAllocateBuffer,MAPI32.DLL,NM,2, allocates a memory buffer.MAPIAllocateMore,MAPI32.DLL,NM,3 allocates a memory buffer that islinked to another bufferpreviously allocated with theMAPIAllocateBuffer function.MAPIFreeBuffer,MAPI32.DLL,NM,1 frees a memory buffer allocated with a call to theMAPIAllocateBuffer function or the MAPIAllocateMore function.MAPIGetDefaultMalloc,MAPI32.DLL,NM,0, retrieves the address of the default MAPI memoryallocation function.MAPIInitialize,MAPI32.DLL,NM,1, increments the MAPI subsystem reference count andinitializes global data for the MAPI DLL.MAPIInitIdle,MAPI32.DLL,NM,1, initializes the MAPI idle engine for the calling application.MAPILogonEx,MAPI32.DLL,NM,5 logs a client application on to a session with the messagingsystem.MAPIOpenFormMgr,MAPI32.DLL,NM,2, opens an IMAPIFormMgr interface on a form libraryprovider object in the context of an existing session.MAPIOpenLocalFormContainer,MAPI32.DLL,NM,1, returns an interface pointer to the localform library.MAPIUninitialize,MAPI32.DLL,NM,0, decrements the reference count, -instance global data forthe MAPI DLL.MapStorageSCode,MAPI32.DLL,NM,1, maps an HRESULT return value from an OLE storageobject to a MAPI return value of the SCODE type.MapViewOfFile,KERNEL32.DLL,NM,5, maps a view of a file into the address space of thecalling process.MapViewOfFileEx,KERNEL32.DLL,NM,6, maps a view of a file into the address space of thecalling process.MapVirtualKey,USER32.DLL,AW,2 translates (maps) a virtual-key codeinto a scan code orcharacter value, or translates a scan code intoa virtual-key code.MapVirtualKeyEx,USER32.DLL,AW,3 translates (maps) a virtual-key codeinto a scan code orcharacter value, or translates a scan code intoa virtual-key code.MapWindowPoints,USER32.DLL,NM,4 converts (maps) a set of points from a coordinate spacerelative to one window to a coordinate space relative to another window.MaskBlt,GDI32.DLL,NM,12, combines the color data for the source and destination bitmapsusing the specified mask and raster operation.mciDriverNotify,WINMM.DLL,NM,3,MCI drivers call mciDriverNotify to post an MM_MCINOTIFYmessage to an application.mciDriverYield,WINMM.DLL,NM,1,calls the application’s yield function. The yield functionchecks to see if the user has pressed the break key.mciFreeCommandResource,WINMM.DLL,NM,1,function frees from memory a command tablethat was loaded with mciLoadCommandResource.mciGetCreatorTask,WINMM.DLL,NM,1, retrieves a handle to the creator task for the specifieddevice.mciGetDeviceID,WINMM.DLL,AW,1, retrieves the device identifier corresponding to the nameof an open device.mciGetDriverData,WINMM.DLL,NM,1,returns instance-specific information that was set withmciSetDriverData.mciGetErrorString,WINMM.DLL,AW,3, retrieves a string that describes the specified MCI errorcode.mciGetYieldProc,WINMM.DLL,NM,2, retrieves the address of the callback function associatedwith the "wait" (MCI_WAIT) flag.mciLoadCommandResource,WINMM.DLL,NM,3,loads the specified resource and registers it asan MCI command table.mciSendCommand,WINMM.DLL,AW,4, sends a command message to the specified MCIdevice.mciSendString,WINMM.DLL,AW,4, sends a command string to an MCI device.mciSetDriverData,WINMM.DLL,NM,2,is used for storing instance-specific information for anMCI driver.mciSetYieldProc,WINMM.DLL,NM,3 sets the address of a procedure to becalled periodicallywhen an MCI device is waiting for a command tofinish because the "wait" (MCI_WAIT) flag wasspecified.MenuHelp,COMCTL32.DLL,NM,7 processes WM_MENUSELECT andWM_COMMANDmessages and displays help text about the current menu in thespecified statuswindow.MenuItemFromPoint,USER32.DLL,NM,4, determines which menu item, if any, is at thespecified location.MesBufferHandleReset,RPCRT4.DLL,NM,6, re-initializes the handle for buffer serialization.MesDecodeBufferHandleCreate,RPCRT4.DLL,NM,3, creates a decoding handle and initializesit for a (fixed) buffer style of serialization.MesDecodeIncrementalHandleCreate,RPCRT4.DLL,NM,3, creates a decoding handle for theincremental style of serialization.MesEncodeDynBufferHandleCreate,RPCRT4.DLL,NM,3 creates an encoding handle and theninitializes it for a dynamic buffer style of serialization.MesEncodeFixedBufferHandleCreate,RPCRT4.DLL,NM,4 creates an encodinghandle and theninitializes it for a fixed buffer style ofserialization.MesEncodeIncrementalHandleCreate,RPCRT4.DLL,NM,4, creates an encoding and theninitializes it for the incremental style of serialization.MesHandleFree,RPCRT4.DLL,NM,1, frees the memory allocated by the serialization handle.MesIncrementalHandleReset,RPCRT4.DLL,NM,6, re-initializes the handle for incrementalserialization.MesInqProcEncodingId,RPCRT4.DLL,NM,3 provides the identity of an encoding.MessageBeep,USER32.DLL,NM,1, plays a waveform sound.MessageBox,USER32.DLL,AW,4, creates, displays, and operates a message box.MessageBoxEx,USER32.DLL,AW,5, creates, displays, and operates a message box.

MessageBoxIndirect,USER32.DLL,AW,1, creates, displays, and operates a message box.midiConnect,WINMM.DLL,NM,3 connects a MIDI input device to a MIDIthru or output device, orconnects a MIDI thru device to a MIDIoutput device.midiDisconnect,WINMM.DLL,NM,3 disconnects a MIDI input device from aMIDI thru or outputdevice, or disconnects a MIDI thru device froma MIDI output device.midiInAddBuffer,WINMM.DLL,NM,3 sends an input buffer to a specified opened MIDI inputdevice.midiInClose,WINMM.DLL,NM,1, closes the specified MIDI input device.midiInGetDevCaps,WINMM.DLL,AW,3, determines the capabilities of a specified MIDI inputdevice.midiInGetErrorText,WINMM.DLL,AW,3, retrieves a textual description for an error identified bythe specified error code.midiInGetID,WINMM.DLL,NM,2, gets the device identifier for the given MIDI input device.midiInGetNumDevs,WINMM.DLL,NM,0, retrieves the number of MIDI input devices in thesystem.midiInMessage,WINMM.DLL,NM,4, sends a message to the MIDI device driver.midiInOpen,WINMM.DLL,NM,5, opens a specified MIDI input device.midiInPrepareHeader,WINMM.DLL,NM,3, prepares a buffer for MIDI input.midiInReset,WINMM.DLL,NM,1, stops input on a given MIDI input device.midiInStart,WINMM.DLL,NM,1, starts MIDI input on the specified MIDI input device.midiInStop,WINMM.DLL,NM,1, stops MIDI input on the specified MIDI input device.midiInUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by themidiInPrepareHeader function.midiOutCacheDrumPatches,WINMM.DLL,NM,4 requests that an internal MIDIsynthesizerdevice preload and cache a specified set of key-basedpercussion patches.midiOutCachePatches,WINMM.DLL,NM,4, requests that an internal MIDI synthesizer devicepreload and cache a specified set of patches.midiOutClose,WINMM.DLL,NM,1, closes the specified MIDI output device.midiOutGetDevCaps,WINMM.DLL,AW,3, queries a specified MIDI output device to determineits capabilities.midiOutGetErrorText,WINMM.DLL,AW,3, retrieves a textual description for an error identified bythe specified error code.midiOutGetID,WINMM.DLL,NM,2 retrieves the device identifier for the given MIDI outputdevice.midiOutGetNumDevs,WINMM.DLL,NM,0, retrieves the number of MIDI output devices presentin the system.midiOutLongMsg,WINMM.DLL,NM,3 sends a system-exclusive MIDI message to the specifiedMIDI output device.midiOutMessage,WINMM.DLL,NM,4, sends a message to the MIDI device drivers.midiOutOpen,WINMM.DLL,NM,5, opens a MIDI output device for playback.midiOutPrepareHeader,WINMM.DLL,NM,3, prepares a MIDI system-exclusive or stream bufferfor output.midiOutReset,WINMM.DLL,NM,1, turns off all notes on all MIDI channels for the specified MIDIoutput device.midiOutSetVolume,WINMM.DLL,NM,2, sets the volume of a MIDI output device.midiOutShortMsg,WINMM.DLL,NM,2 sends a short MIDI message tothemidiOutGetVolumespecified MIDI output device.midiOutUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by themidiOutPrepareHeader function.midiStreamClose,WINMM.DLL,NM,1, closes an open MIDI stream.midiStreamOpen,WINMM.DLL,NM,6, opens a MIDI stream for output.midiStreamOut,WINMM.DLL,NM,3, plays or queues a stream (buffer) of MIDI data to a MIDIoutput device.midiStreamPause,WINMM.DLL,NM,1, pauses playback of a specified MIDI stream.midiStreamPosition,WINMM.DLL,NM,3, retrieves the current position in a MIDI stream.midiStreamProperty,WINMM.DLL,NM,3, sets or retrieves properties of a MIDI data streamassociated with a MIDI output device.midiStreamRestart,WINMM.DLL,NM,1, restarts a paused MIDI stream.midiStreamStop,WINMM.DLL,NM,1, turns off all notes on all MIDI channels for the specifiedMIDI output device.MIMEAssociationDialog,URL.DLL,AW,6,Runs the unregistered Multipurpose Internet MailExtensions (MIME) content type dialog box.mixerClose,WINMM.DLL,NM,1, closes the specified mixer device.mixerGetControlDetails,WINMM.DLL,AW,3, retrieves details about a single control associatedwith an audio line.mixerGetDevCaps,WINMM.DLL,AW,3, queries a specified mixer device to determine itscapabilities.mixerGetID,WINMM.DLL,NM,3, retrieves the device identifier for a mixer device associated witha specified device handle.mixerGetLineControls,WINMM.DLL,AW,3, retrieves one or more controls associated with anaudio line.mixerGetLineInfo,WINMM.DLL,AW,3, retrieves information about a specific line of a mixerdevice.mixerGetNumDevs,WINMM.DLL,NM,0, retrieves the number of mixer devices present in thesystem.mixerMessage,WINMM.DLL,NM,4, sends a custom mixer driver message directly to a mixerdriver.mixerOpen,WINMM.DLL,NM,5 opens a specified mixer device and ensures that the device willnot be removed until the application closes the handle.mixerSetControlDetails,WINMM.DLL,NM,3, sets properties of a single control associated withan audio line.MkParseDisplayName,OLE32.DLL,NM,4,Ex Creates a moniker to the object that is specified bythe given string.MkParseDisplayNameEx,URLMON.DLL,NM,4, Creates a moniker to the object that is specifiedby the given string.mmioAdvance,WINMM.DLL,NM,3, advances the I/O buffer of a file set up for direct I/O bufferaccess with the mmioGetInfo function.mmioAscend,WINMM.DLL,NM,3 ascends out of a chunk in a RIFF filedescended into with themmioDescend function or created with themmioCreateChunk function.mmioClose,WINMM.DLL,NM,2, closes a file that was opened by using the mmioOpen function.mmioCreateChunk,WINMM.DLL,NM,3, creates a chunk in a RIFF file that was opened by usingthe mmioOpen function.mmioDescend,WINMM.DLL,NM,4, descends into a chunk of a RIFF file that was opened byusing the mmioOpen function.mmioFlush,WINMM.DLL,NM,2, writes the I/O buffer of a file to disk if the buffer has beenwritten to.mmioGetInfo,WINMM.DLL,NM,3 retrieves information about a file openedby using themmioOpen function.mmioInstallIOProc,WINMM.DLL,AW,3, maintains a separate list of installed I/O procedures foreach Windows application.mmioOpen,WINMM.DLL,AW,3, opens a file for unbuffered or buffered I/O.mmioRead,WINMM.DLL,NM,3, reads a specified number of bytes from a file opened by usingthe mmioOpen function.mmioRename,WINMM.DLL,AW,4, renames the specified file.mmioSeek,WINMM.DLL,NM,3, changes the current file position in a file opened by using themmioOpen function.mmioSendMessage,WINMM.DLL,NM,4, sends a message to the I/O procedure associated withthe specified file.

Page 141: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

141mmioSetBuffer,WINMM.DLL,NM,4 enables or disables buffered I/O, or changes the buffer orbuffer size for a file opened by using the mmioOpen function.mmioSetInfo,WINMM.DLL,NM,3 updates the information retrieved by themmioGetInfo functionabout a file opened by using the mmioOpenfunction.mmioStringToFOURCC,WINMM.DLL,AW,2 converts a null-terminated string to a four-character code.mmioWrite,WINMM.DLL,NM,3 writes a specified number of bytes to a filemmioOpenopened byusing the function.ModifyMenu,USER32.DLL,AW,5, changes an existing menu item.ModifyWorldTransform,GDI32.DLL,NM,3, changes the world transformation for a device contextusing the specified mode.Module32First,TOOLHELP.DLL,NM,2, retrieves information about the first module associatedwith a process.Module32Next,TOOLHELP.DLL,NM,2, retrieves information about the next module associatedwith a process or thread.MonikerCommonPrefixWith,OLE32.DLL,NM,3,This function creates a new moniker based onthe common prefix that this moniker (the one comprising the data of this moniker object) shareswith another moniker.MonikerRelativePathTo,OLE32.DLL,NM,4,4.2 MonikerRelativePathTo This function providesa moniker that, when composed onto the end of the first specified moniker (or one with a similarMountNtmsMedia,NTMSAPI.DLL,NM,7, synchronously mounts one or more pieces of media.mouse_event,USER32.DLL,NM,5, synthesizes mouse motion and button clicks.MoveFile,KERNEL32.DLL,AW,2, renames an existing file or a directory (including all itschildren).MoveFileEx,KERNEL32.DLL,AW,3, renames an existing file or directory.MoveToEx,GDI32.DLL,NM,4, updates the current position to the specified point and optionallyreturns the previous position.MoveToNtmsMediaPool,NTMSAPI.DLL,NM,3, moves the specified medium from its currentmedia pool to the specified media pool.MoveWindow,USER32.DLL,NM,6, changes the position and dimensions of the specifiedwindow.MprAdminBufferFree,MPRAPI.DLL,NM,1, frees memory buffers returned by:MprAdminInterfaceGetInfo, MprAdminInterfaceEnum, MprAdminServerGetInfo,MprAdminInterfaceTransportGetInfo, and MprAdminTransportGetInfo.MprAdminConnectionEnum,MPRAPI.DLL,NM,7, enumerates all active connections.MprAdminConnectionGetInfo,MPRAPI.DLL,NM,4, provides information on a specificconnection.MprAdminDeregisterConnectionNotification,MPRAPI.DLL,NM,2, deregisters an event objectthat was previously registered using MprAdminRegisterConnectionNotification. Oncederegistered, this event is no longer signaled when an interface connects or disconnects.MprAdminEstablishDomainRasServer,MPRAPI.DLL,NM,3, establishes the given machine as aRemote Access Server in the domain. This function must be executed only on a machine joinedto a domain.MprAdminGetErrorString,MPRAPI.DLL,NM,2, returns the string associated with a router errorfrom Mprerror.h.MprAdminGetPDCServer,MPRAPI.DLL,NM,3, retrieves the name of the server with the masterUser Accounts Subsystem (UAS) from either a domain name or a server name. Either thedomain name parameter or the server name parameter may be NULL, but not both.MprAdminInterfaceConnect,MPRAPI.DLL,NM,4, creates a connection to the specified WANinterface.MprAdminInterfaceCreate,MPRAPI.DLL,NM,4, creates an interface on a specified server.MprAdminInterfaceDelete,MPRAPI.DLL,NM,2, deletes an interface on a specified server.MprAdminInterfaceDisconnect,MPRAPI.DLL,NM,2, disconnects a connected WAN interface.MprAdminInterfaceEnum,MPRAPI.DLL,NM,7, enumerates all the interfaces on a specifiedserver.MprAdminInterfaceGetCredentials,MPRAPI.DLL,NM,5,Use theMprAdminInterfaceGetCredentials function to retrieve the domain, user name, and password fordialing out on the specified demand-dial interface.MprAdminInterfaceGetHandle,MPRAPI.DLL,NM,4, retrieves a handle to a specified interface.MprAdminInterfaceGetInfo,MPRAPI.DLL,NM,4, retrieves information for a specified interface ona specified server.MprAdminInterfaceQueryUpdateResult,MPRAPI.DLL,NM,4, returns the result of the lastrequest to a specified router manager to update its routes for a specified interface. For moreinformation, see MprAdminInterfaceUpdateRoutes.MprAdminInterfaceSetCredentials,MPRAPI.DLL,NM,5,Use MprAdminInterfaceSetCredentialsfunction to set the domain, user name, and password that will be used for dialing out on thespecified demand-dial interface.MprAdminInterfaceSetInfo,MPRAPI.DLL,NM,4, sets information for a specified interface on aspecified server.MprAdminInterfaceTransportAdd,MPRAPI.DLL,NM,5, adds a transport (for example, IP or IPX)to a specified interface.MprAdminInterfaceTransportGetInfo,MPRAPI.DLL,NM,5, retrieves information about a transportrunning on a specified interface.MprAdminInterfaceTransportRemove,MPRAPI.DLL,NM,3, removes a transport (for example, IPor IPX) from a specified interface.MprAdminInterfaceTransportSetInfo,MPRAPI.DLL,NM,5, sets information for a transportrunning on a specified interface.MprAdminInterfaceUpdatePhonebookInfo,MPRAPI.DLL,NM,2, forces the router to pick upchanges made on a specified demand-dial interface. Call this function after changes are madeto a phone-book entry for a demand-dial interface.MprAdminInterfaceUpdateRoutes,MPRAPI.DLL,NM,4, requests a specified router manager toupdate its routing information for a specified interface.MprAdminIsDomainRasServer,MPRAPI.DLL,NM,3, returns information regarding whether thegiven machine is registered as the remote access server in the domain.MprAdminIsServiceRunning,MPRAPI.DLL,NM,1,, if the calling process has access, checkswhether RRAS is running on a specified machine.MprAdminMIBBufferFree,MPRAPI.DLL,NM,1, frees buffers returned by the following functions:MprAdminMIBEntryGet, MprAdminMIBEntryGetFirst, MprAdminMIBEntryGetNextMprAdminMIBEntryCreate,MPRAPI.DLL,NM,5, creates an entry for one of the variablesexported by a routing protocol or router manager.MprAdminMIBEntryDelete,MPRAPI.DLL,NM,5, deletes an entry for one of the variablesexported by a routing protocol or router manager.MprAdminMIBEntryGet,MPRAPI.DLL,NM,7, retrieves the value of one of the variables exportedby a routing protocol or router manager.MprAdminMIBEntryGetFirst,MPRAPI.DLL,NM,7, retrieves the first variable of some set ofvariables exported by a protocol or router manager. The module that services the call definesfirst.MprAdminMIBEntryGetNext,MPRAPI.DLL,NM,7, retrieves the next variable of some set ofvariables exported by a protocol or router manager. The module that services the call definesnext.MprAdminMIBEntrySet,MPRAPI.DLL,NM,5, sets the value of one of the variables exported by arouting protocol or router manager.MprAdminMIBServerConnect,MPRAPI.DLL,NM,2, establishes a connection to the router beingadministered. This call should be made before any other calls to the server. The handlereturned by this function is used in subsequent MIB calls.MprAdminMIBServerDisconnect,MPRAPI.DLL,NM,1, disconnects the connection made by aprevious call to MprAdminMIBServerConnect.MprAdminPortClearStats,MPRAPI.DLL,NM,2, resets the statistics for the specified port.MprAdminPortDisconnect,MPRAPI.DLL,NM,2, disconnects a connection on a specific port.

MprAdminPortEnum,MPRAPI.DLL,NM,8, enumerates all active ports in a specific connection,or all ports available for use or currently in use by RAS.MprAdminPortGetInfo,MPRAPI.DLL,NM,4, gets information for a specific port.MprAdminPortReset,MPRAPI.DLL,NM,2, resets the communication device attached to thespecified port.MprAdminRegisterConnectionNotification,MPRAPI.DLL,NM,2, registers an event object with theDemand Dial Manager (DDM) so that, if an interface connects or disconnects, the event issignaled.MprAdminSendUserMessage,MPRAPI.DLL,NM,3, sends a message to the user connected onthe specified connection.MprAdminServerConnect,MPRAPI.DLL,NM,2, establishes a connection to a router for thepurpose of administering that router.MprAdminServerDisconnect,MPRAPI.DLL,NM,1, disconnects the connection made by aprevious call to MprAdminServerConnect.MprAdminServerGetInfo,MPRAPI.DLL,NM,3, retrieves information about the specified RRASserver.MprAdminTransportGetInfo,MPRAPI.DLL,NM,6, retrieves global information, default clientinterface information, or both, for a specified transport.MprAdminTransportSetInfo,MPRAPI.DLL,NM,6, sets global information, or default clientinterface information, or both, for a specified transport.MprAdminUserGetInfo,MPRAPI.DLL,NM,4, retrieves all RAS information for a particular user.MprAdminUserSetInfo,MPRAPI.DLL,NM,4, sets RAS information for the specified user.MprConfigBufferFree,MPRAPI.DLL,NM,1,The Routing and Remote Access Service (RRAS)API makes it possible to create applications to administer the routing and remote accessservice capabilities of Microsoft Windows 2003 Server family and Windows Server 2000operating systems.MprConfigGetFriendlyName,MPRAPI.DLL,NM,4, returns the friendly name for an interface thatcorresponds to the specified GUID name.MprConfigGetGuidName,MPRAPI.DLL,NM,4, returns the GUID name for an interface thatcorresponds to the specified friendly name.MprConfigInterfaceCreate,MPRAPI.DLL,NM,4, creates a router interface in the specified routerconfiguration.MprConfigInterfaceDelete,MPRAPI.DLL,NM,2, removes a router interface from the routerconfiguration. All transport information associated with this interface is also removed.MprConfigInterfaceEnum,MPRAPI.DLL,NM,7, enumerates the interfaces that are configured forthe router.MprConfigInterfaceGetHandle,MPRAPI.DLL,NM,3, retrieves a handle to the specifiedinterface's configuration in the specified router configuration.MprConfigInterfaceGetInfo,MPRAPI.DLL,NM,5, retrieves the configuration for the specifiedinterface from the router.MprConfigInterfaceSetInfo,MPRAPI.DLL,NM,4, sets the configuration for the specified interface.MprConfigInterfaceTransportAdd,MPRAPI.DLL,NM,7, adds the specified transport to thespecified interface configuration on the router.MprConfigInterfaceTransportEnum,MPRAPI.DLL,NM,8, enumerates the transports configuredon the specified interface.MprConfigInterfaceTransportGetHandle,MPRAPI.DLL,NM,4, retrieves a handle to the specifiedtransport configuration on the specified interface in the specified router configuration.MprConfigInterfaceTransportGetInfo,MPRAPI.DLL,NM,5, retrieves the configuration informationfor the specified client on the specified interface.MprConfigInterfaceTransportRemove,MPRAPI.DLL,NM,3, removes the specified transport fromthe specified interface configuration on the router.MprConfigInterfaceTransportSetInfo,MPRAPI.DLL,NM,5, updates the configuration informationfor the client on the specified interface and transport.MprConfigServerBackup,MPRAPI.DLL,NM,2, creates a backup of the router-manager,interface, and phone-book configuration for the router.MprConfigServerConnect,MPRAPI.DLL,NM,2, connects to the router to be configured.MprConfigServerDisconnect,MPRAPI.DLL,NM,1, disconnects a connection made by a previouscall to MprConfigServerConnect.MprConfigServerGetInfo,MPRAPI.DLL,NM,3, retrieves server-level configuration information forthe specified router.MprConfigServerRestore,MPRAPI.DLL,NM,2, restores the router-manager, interface, andphone-book configuration from a backup created by a previous call to MprConfigServerBackup.MprConfigTransportCreate,MPRAPI.DLL,NM,9, adds the specified transport to the list oftransports present in the specified router configuration.MprConfigTransportDelete,MPRAPI.DLL,NM,2, removes the specified transport from the list oftransports present in the specified router configuration.MprConfigTransportEnum,MPRAPI.DLL,NM,7, enumerates the transports configured on therouter.MprConfigTransportGetHandle,MPRAPI.DLL,NM,3, retrieves a handle to the specifiedtransport's configuration in the specified router configuration.MprConfigTransportGetInfo,MPRAPI.DLL,NM,7, retrieves the configuration for the specifiedtransport from the router.MprConfigTransportSetInfo,MPRAPI.DLL,NM,7, changes the configuration for the specifiedtransport in the specified router configuration.MprInfoBlockAdd,MPRAPI.DLL,NM,6, creates a new header that is identical to an existingheader with the addition of a new block.MprInfoBlockFind,MPRAPI.DLL,NM,5, locates a specified block in an information header, andretrieves information about the block.MprInfoBlockRemove,MPRAPI.DLL,NM,3, creates a new header that is identical to an existingheader with a specified block removed.MprInfoBlockSet,MPRAPI.DLL,NM,6,The MprInfoBlockSet creates a new header that isidentical to an existing header with a specified block modified.MprInfoCreate,MPRAPI.DLL,NM,2, creates a new information header.MprInfoDelete,MPRAPI.DLL,NM,1, deletes an information header created using MprInfoCreate,or retrieved by MprInfoBlockAdd, MprInfoBlockRemove, or MprInfoBlockSet.MprInfoDuplicate,MPRAPI.DLL,NM,2, duplicates an existing information header.MprInfoRemoveAll,MPRAPI.DLL,NM,2, removes all information blocks from the specifiedheader.MsgWaitForMultipleObjects,USER32.DLL,NM,5 returns when either any one or all of thespecified objects are in the signaled state or The time-out interval elapses.MsgWaitForMultipleObjectsEx,USER32.DLL,NM,5 returns when Either any one or all of thespecified objects are in the signaled state or An I/O completion routine or asynchronousprocedure call (APC) is queued to the thread. orThe time-out interval elapses.MulDiv,KERNEL32.DLL,NM,3 multiplies two 32-bit values and then dividesthe 64-bit result by athird 32-rounded up or down to the nearest integer.MultiByteToWideChar,KERNEL32.DLL,NM,6 maps a character string to a wide-character(Unicode) string.MultinetGetConnectionPerformance,MPR.DLL,AW,2 returns informationabout the expectedperformance of a connection used to access anetwork resource.NetAccessAdd,SVRAPI.DLL,NM,4, is obsolete.NetAccessCheck,SVRAPI.DLL,NM,5, is obsolete.NetAccessDel,SVRAPI.DLL,NM,2, is obsolete.NetAccessEnum,SVRAPI.DLL,NM,8, is obsolete.NetAccessGetInfo,SVRAPI.DLL,NM,6, is obsolete.NetAccessGetUserPerms,SVRAPI.DLL,NM,4, is obsolete.NetAccessSetInfo,SVRAPI.DLL,NM,6,s is obsolete.NetAlertRaise,NETAPI32.DLL,NM,3, notifies all registered clients that a particular eventoccurred.

Page 142: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

142NetAlertRaiseEx,NETAPI32.DLL,NM,4, simplifies the raising of an Administrators interruptingmessage.NetApiBufferAllocate,NETAPI32.DLL,NM,2, allocates memory from the heap.NetApiBufferFree,NETAPI32.DLL,NM,1, frees the memory that NetApiBufferAllocate allocates.NetApiBufferReallocate,NETAPI32.DLL,NM,3, changes the size of a buffer allocated withNetApiBufferAllocate.NetApiBufferSize,NETAPI32.DLL,NM,2, returns the size, in bytes, of the allocated buffer usingNetApiBufferAllocate.NetAuditClear,NETAPI32.DLL,NM,3 is obsolete.NetAuditRead,NETAPI32.DLL,NM,11, is obsolete.Netbios,NETAPI32.DLL,NM,1, interprets and executes the specified network control block(NCB).NetConfigGet,NETAPI32.DLL,NM,4 is obsolete.NetConfigGetAll,NETAPI32.DLL,NM,3, is obsolete.NetConfigSet,NETAPI32.DLL,NM,7, is obsolete.NetConnectionEnum,NETAPI32.DLL,NM,8 lists all connections made to ashared resource onthe server or all connections established from aparticular computer.NetConnectionEnum,SVRAPI.DLL,NM,7 lists all connections made to ashared resource on theserver or all connections established from aparticular computer.NetErrorLogClear,NETAPI32.DLL,NM,3, is obsolete.NetErrorLogRead,NETAPI32.DLL,NM,11, is obsolete.NetFileClose,NETAPI32.DLL,NM,2, is obsolete in the Win32-based application programminginterface (API).NetFileEnum,NETAPI32.DLL,NM,9 supplies information about some or all open files on aserver, allowing the user to supply a resume handle and get required information throughrepeated calls to the function.NetFileEnum,SVRAPI.DLL,NM,7 returns information about some or all open files on a server,depending on the parameters specified.NetFileGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular opening of aserver resource.NetGetAnyDCName,NETAPI32.DLL,NM,3, gets the name of any domain controller for adomain that is directly trusted by the server name.NetGetDCName,NETAPI32.DLL,NM,3, returns the name of the Primary Domain Controller(PDC) for the specified domain.NetGroupAdd,NETAPI32.DLL,NM,4, creates a global group in the security database.NetGroupAddUser,NETAPI32.DLL,NM,3, gives an existing user account membership in anexisting global group.NetGroupDel,NETAPI32.DLL,NM,2, deletes a global group account from the account database.NetGroupDelUser,NETAPI32.DLL,NM,3, removes a user from a particular global group in thesecurity database.NetGroupEnum,NETAPI32.DLL,NM,7, retrieves information about each global group account.NetGroupGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular global groupaccount on a server.NetGroupGetUsers,NETAPI32.DLL,NM,8, retrieves a list of the members of a particular globalgroup in the security database.NetGroupSetInfo,NETAPI32.DLL,NM,5, sets the parameters of a global group account.NetGroupSetUsers,NETAPI32.DLL,NM,5 sets the global group membership for the specifiedglobal group.NetLocalGroupAdd,NETAPI32.DLL,NM,4 creates a local group in the security database.NetLocalGroupAddMember,NETAPI32.DLL,NM,3, is obsolete.NetLocalGroupDel,NETAPI32.DLL,NM,2, deletes a local group account and all its membersfrom the accounts database.NetLocalGroupDelMember,NETAPI32.DLL,NM,3, is obsolete.NetLocalGroupEnum,NETAPI32.DLL,NM,7, retrieves information about each local groupaccount.NetLocalGroupGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular localgroup account on a server.NetLocalGroupGetMembers,NETAPI32.DLL,NM,8, retrieves a list of the members of aparticular local group in the security database.NetLocalGroupSetInfo,NETAPI32.DLL,NM,5, sets the parameters of a local group.NetLocalGroupSetMembers,NETAPI32.DLL,NM,5, sets the local group membership for thespecified local group.NetMessageBufferSend,NETAPI32.DLL,NM,5, sends a buffer of information to a registeredmessage alias.NetMessageNameAdd,NETAPI32.DLL,NM,2, registers a message alias in the message nametable.NetMessageNameDel,NETAPI32.DLL,NM,2, deletes a message alias from the table ofmessage aliases on a computer.NetMessageNameEnum,NETAPI32.DLL,NM,7 lists the message aliases that will receivemessages on a specified computer.NetMessageNameGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particularmessage alias in the message name table.NetRemoteTOD,NETAPI32.DLL,NM,2 returns the time of day information from a specifiedserver.NetReplExportDirAdd,NETAPI32.DLL,NM,4 registers an existing directory inthe export path tobe replicated.NetReplExportDirDel,NETAPI32.DLL,NM,2, removes registration of a replicated directory.NetReplExportDirEnum,NETAPI32.DLL,NM,7, lists the replicated directories in the export path.NetReplExportDirGetInfo,NETAPI32.DLL,NM,4, retrieves the control information of a replicateddirectory.NetReplExportDirLock,NETAPI32.DLL,NM,2, locks a replicated directory so that replicationfrom it can be suspended.NetReplExportDirSetInfo,NETAPI32.DLL,NM,5, modifies the control information of a replicateddirectory.NetReplExportDirUnlock,NETAPI32.DLL,NM,3, unlocks a directory so that replication from itcan resume.NetReplGetInfo,NETAPI32.DLL,NM,3, retrieves configuration information for the Replicatorservice.NetReplImportDirAdd,NETAPI32.DLL,NM,4, registers an existing directory in the import path toreceive replication from a master.NetReplImportDirDel,NETAPI32.DLL,NM,2, removes the registration of a directory so that it nolonger receives updates from the master.NetReplImportDirEnum,NETAPI32.DLL,NM,7, lists the replicated directories in the import path.NetReplImportDirGetInfo,NETAPI32.DLL,NM,4, retrieves the status information on a clientreplicated directory.NetReplImportDirLock,NETAPI32.DLL,NM,2, locks a replicated directory so that replication to itcan be suspended.NetReplImportDirUnlock,NETAPI32.DLL,NM,3, unlocks a directory so that replication to it canresume.NetReplSetInfo,NETAPI32.DLL,NM,4, modifies the Replicator service configuration information.NetScheduleJobAdd,NETAPI32.DLL,NM,3, submits a job to run at a specified future time anddate.NetScheduleJobDel,NETAPI32.DLL,NM,3 deletes a range of jobs queued to, Net Functionsrunat a computer.NetScheduleJobEnum,NETAPI32.DLL,NM,6, lists the jobs queued on a specified computer.NetScheduleJobGetInfo,NETAPI32.DLL,NM,3 retrieves information about a particular jobqueued on a specified computer.NetServerDiskEnum,NETAPI32.DLL,NM,7, retrieves a list of disk drives on a server.

NetServerEnum,NETAPI32.DLL,NM,9, lists all servers of the specified type that are visible inthe specified domain.NetServerGetInfo,NETAPI32.DLL,NM,3, retrieves information about the specified server.NetServerGetInfo,SVRAPI.DLL,NM,5, retrieves information about the specified server.NetServerSetInfo,NETAPI32.DLL,NM,4, sets a server?s operating parameters; it can set themindividually or collectively.NetServerTransportAdd,NETAPI32.DLL,NM,3, binds the server to the transport.NetServerTransportDel,NETAPI32.DLL,NM,3 unbinds (or disconnects) the transport protocolfrom the server.NetServerTransportEnum,NETAPI32.DLL,NM,7, supplies information about transports that aremanaged by the server.NetServiceControl,NETAPI32.DLL,NM,5, is obsolete.NetServiceEnum,NETAPI32.DLL,NM,7 is obsolete.NetServiceGetInfo,NETAPI32.DLL,NM,4, is obsolete.NetServiceInstall,NETAPI32.DLL,NM,5, is obsolete.NetSessionDel,NETAPI32.DLL,NM,3, ends a session between a server and a workstation.NetSessionDel,SVRAPI.DLL,NM,3, ends a session between a server and a workstation.NetSessionEnum,NETAPI32.DLL,NM,9, provides information about all current sessions.NetSessionEnum,SVRAPI.DLL,NM,6, provides information about all current sessions.NetSessionGetInfo,NETAPI32.DLL,NM,5, retrieves information about a session establishedbetween a particular server and workstation.NetSessionGetInfo,SVRAPI.DLL,NM,6, retrieves information about a session establishedbetween a particular server and workstation.NetShareAdd,NETAPI32.DLL,NM,4, shares a server resource.NetShareAdd,SVRAPI.DLL,NM,4, shares a server resource.NetShareCheck,NETAPI32.DLL,NM,3, checks whether or not a server is sharing a device.NetShareDel,NETAPI32.DLL,NM,3 deletes a share name from a server?s listof sharedresources, disconnecting all connections to the sharedresource.NetShareDel,SVRAPI.DLL,NM,3 deletes a share name from a server?s listof shared resources,disconnecting all connections to the sharedresource.NetShareGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular sharedresource on a server.NetShareGetInfo,SVRAPI.DLL,NM,6, retrieves information about a particular shared resourceon a server.NetShareSetInfo,NETAPI32.DLL,NM,5 sets the parameters of a shared resource.NetShareSetInfo,SVRAPI.DLL,NM,6 sets the parameters of a shared resource.NetStatisticsGet,NETAPI32.DLL,NM,5 is obsolete.NetUseDel,NETAPI32.DLL,NM,3, is obsolete.NetUseEnum,NETAPI32.DLL,NM,7 is obsolete.NetUseGetInfo,NETAPI32.DLL,NM,4, is obsolete.NetUserAdd,NETAPI32.DLL,NM,4, adds a user account and assigns a password and privilegelevel.NetUserDel,NETAPI32.DLL,NM,2, deletes a user account from a server.NetUserEnum,NETAPI32.DLL,NM,8, provides information about all user accounts on a server.NetUserGetGroups,NETAPI32.DLL,NM,7, retrieves a list of global groups to which a specifieduser belongs.NetUserGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular user account ona server.NetUserGetLocalGroups,NETAPI32.DLL,NM,8, retrieves a list of local groups to which aspecified user belongs.NetUserModalsGet,NETAPI32.DLL,NM,3 retrieves global information for all users and globalgroups in the security database.NetUserModalsSet,NETAPI32.DLL,NM,4, sets global information for all users and globalgroups in the security database.NetUserSetGroups,NETAPI32.DLL,NM,5 sets global group memberships for a specified useraccount.NetUserSetInfo,NETAPI32.DLL,NM,5, sets the parameters of a user account.NetWkstaGetInfo,NETAPI32.DLL,NM,3, returns information about the configuration elementsfor a workstation.NetWkstaSetInfo,NETAPI32.DLL,NM,4, configures a workstation.NetWkstaTransportAdd,NETAPI32.DLL,NM,4, binds (or connects) the redirector to thetransport.NetWkstaTransportDel,NETAPI32.DLL,NM,3 unbinds the transport protocolfrom the redirector,which is the software on the client computerwhich generates file requests to the servercomputer.NetWkstaTransportEnum,NETAPI32.DLL,NM,7 supplies information about transport protocolsthat are managed by the redirector, which is the software on the client computer that generatesfile requests to the server computer.NetWkstaUserEnum,NETAPI32.DLL,NM,7, lists information about all users currently logged onto the workstation.NetWkstaUserGetInfo,NETAPI32.DLL,NM,3, returns information about the currently logged-onuser.NetWkstaUserSetInfo,NETAPI32.DLL,NM,4, sets the user-specific information about theconfiguration elements for a workstation.NotifyBootConfigStatus,ADVAPI32.DLL,NM,1, reports the boot status to the service controlmanager.NotifyChangeEventLog,ADVAPI32.DLL,NM,2 enables an application to receivenotificationwhen an event is written to the specified event logfile.NTExport,DAPI.DLL,AW,1 exports user information from a Windows NTServer domaincontroller in a form that can later be imported intothe Microsoft Exchange Server directory.ntohl,WS2_32.DLL,NM,1, converts a u_long from TCP/IP network order to host byte order(which is little-endian on Intel processors).ntohl,WSOCK32.DLL,NM,1, converts a u_long from TCP/IP network order to host byte order(which is little-endian on Intel processors).ntohs,WS2_32.DLL,NM,1, converts a u_short from TCP/IP network byte order to host byteorder (which is little-endian on Intel processors).ntohs,WSOCK32.DLL,NM,1, converts a u_short from TCP/IP network byte order to host byteorder (which is little-endian on Intel processors).NWExport,DAPI.DLL,AW,1 exports user information from a NovellNetWare server in a form thatcan later be imported into theMicrosoft Exchange Server directory.OaBuildVersion,OLEAUT32.DLL,NM,0, This function retrieves the build version of OLEAutomation. WINOLEAUTAPI_(ULONG) OaBuildVersion(void); Return Values The returnvalue is a number that indicates the build number.ObjectCloseAuditAlarm,ADVAPI32.DLL,AW,3, generates audit messages when a handle of anobject is deleted.ObjectDeleteAuditAlarm,ADVAPI32.DLL,AW,3, generates audit messages when an object isdeleted.ObjectOpenAuditAlarm,ADVAPI32.DLL,AW,12 generates audit messages when aclientapplication attempts to gain access to an object or tocreate a new one.ObjectPrivilegeAuditAlarm,ADVAPI32.DLL,AW,6, requires the calling process to haveSE_AUDIT_NAME privilege.OemKeyScan,USER32.DLL,NM,1, maps OEM ASCII codes 0 through 0x0FF into the OEMscan codes and shift states.OemToChar,USER32.DLL,AW,2, translates a string from the OEM-defined character set intoeither an ANSI or a wide-character string.OemToCharBuff,USER32.DLL,AW,3 translates a specified number ofcharacters in a string fromthe OEM-defined character set intoeither an ANSI or a wide-character string.OffsetClipRgn,GDI32.DLL,NM,3, moves the clipping region of a device context by the specifiedoffsets.

Page 143: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

143OffsetRect,USER32.DLL,NM,3, moves the specified rectangle by the specified offsets.OffsetRgn,GDI32.DLL,NM,3, moves a region by the specified offsets.OffsetViewportOrgEx,GDI32.DLL,NM,4, modifies the viewport origin for a device context usingthe specified horizontal and vertical offsets.OffsetWindowOrgEx,GDI32.DLL,NM,4, modifies the window origin for a device context usingthe specified horizontal and vertical offsets.OleConvertIStorageToOLESTREAM,OLE32.DLL,NM,2, converts the specified storage objectfrom OLE 2 structured storage to the OLE 1 storage object model but does not include thepresentation data. This is one of several compatibility functions.OleConvertIStorageToOLESTREAMEx,OLE32.DLL,NM,7, converts the specified storage objectfrom OLE 2 structured storage to the OLE 1 storage object model, including the presentationdata.OleConvertOLESTREAMToIStorage,OLE32.DLL,NM,3,Converts the specified object from theOLE 1 storage model to an OLE 2 structured storage object without specifying presentationdata.OleConvertOLESTREAMToIStorageEx,OLE32.DLL,NM,7, converts the specified object fromthe OLE 1 storage model to an OLE 2 structured storage object including presentation data.This is one of several compatibility functions.OleCreate,OLE32.DLL,NM,7,PropertyFrameIndirectCreates a property frame, that is, a propertysheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters, ratherthan specifying separate parameters as when calling OleCreatePropertyFrame.OleCreateDefaultHandler,OLE32.DLL,NM,4,Creates a new instance of the default embeddinghandler. This instance is initialized so it creates a local server when the embedded objectenters the running state.OleCreateEmbeddingHelper,OLE32.DLL,NM,6,Creates an OLE embedding helper object usingapplication-supplied code aggregated with pieces of the OLE default object handler. This helperobject can be created and used in a specific context and role, as determined by the caller.OleCreateEx,OLE32.DLL,NM,12,Extends OleCreate functionality by supporting more efficientinstantiation of objects in containers requiring caching of multiple presentation formats or data,instead of the single format supportedOleCreateFontIndirect,OLEAUT32.DLL,NM,3, This function creates and initializes a standardfont object using an initial description of the font's properties in a FONTDESC structure. Thefunction returns an interface pointer to the new font object specified by caller in the riidparameter.OleCreateFontIndirect,OLEPRO32.DLL,NM,3, This function creates and initializes a standardfont object using an initial description of the font's properties in a FONTDESC structure. Thefunction returns an interface pointer to the new font object specified by caller in the riidparameter.OleCreateFromData,OLE32.DLL,NM,7,Extends OleCreateFromData functionality by supportingmore efficient instantiation of objects in containers requiring caching of multiple formats ofpresentation or data, instead of the singleOleCreateFromDataEx,OLE32.DLL,NM,12,Extends OleCreateFromData functionality bysupporting more efficient instantiation of objects in containers requiring caching of multipleformats of presentation or data, instead of the singleOleCreateFromFile,OLE32.DLL,NM,8,ExExtends OLeCreateFromFile functionality bysupporting more efficient instantiation of objects in containers requiring caching of multiplepresentation formats or data, instead of the single formatOleCreateFromFileEx,OLE32.DLL,NM,13,Extends OLeCreateFromFile functionality bysupporting more efficient instantiation of objects in containers requiring caching of multiplepresentation formats or data, instead of the single formatOleCreateLink,OLE32.DLL,NM,7,ToFileExExtends OleCreateLinkToFile functionality bysupporting more efficient instantiation of objects in containers requiring caching of multipleformats of presentations or data, instead of the singleOleCreateLinkEx,OLE32.DLL,NM,12,Extends OleCreateLink functionality by supporting moreefficient instantiation of objects in containers requiring caching of multiple formats ofpresentations or data, instead of the single formatOleCreateLinkFromData,OLE32.DLL,NM,7,ExExtends OleCreateLinkFromData functionality bysupporting more efficient instantiation of objects in containers requiring caching of multipleformats of presentations or data, instead of the singleOleCreateLinkFromDataEx,OLE32.DLL,NM,12,Extends OleCreateLinkFromData functionalityby supporting more efficient instantiation of objects in containers requiring caching of multipleformats of presentations or data, instead of the singleOleCreateLinkToFile,OLE32.DLL,NM,7,ExExtends OleCreateLinkToFile functionality bysupporting more efficient instantiation of objects in containers requiring caching of multipleformats of presentations or data, instead of the singleOleCreateLinkToFileEx,OLE32.DLL,NM,12,Extends OleCreateLinkToFile functionality bysupporting more efficient instantiation of objects in containers requiring caching of multipleformats of presentations or data, instead of the singleOleCreateMenuDescriptor,OLE32.DLL,NM,2,Creates and returns an OLE menu descriptor (thatis, an OLE-provided data structure that describes the menus) for OLE to use when dispatchingmenu messages and commands.OleCreatePictureIndirect,OLEAUT32.DLL,NM,4,Creates a new picture object initializedaccording to a PICTDESC structure, which can be NULL to create an uninitialized object if thecaller wishes to have the picture initialize itself through IPersistStream::Load.OleCreatePictureIndirect,OLEPRO32.DLL,NM,4,Creates a new picture object initializedaccording to a PICTDESC structure, which can be NULL to create an uninitialized object if thecaller wishes to have the picture initialize itself through IPersistStream::Load.OleCreatePropertyFrame,OLEAUT32.DLL,NM,11,IndirectCreates a property frame, that is, aproperty sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters,rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreatePropertyFrame,OLEPRO32.DLL,NM,11,IndirectCreates a property frame, that is, aproperty sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters,rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreatePropertyFrameIndirect,OLEAUT32.DLL,NM,1,Creates a property frame, that is, aproperty sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters,rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreatePropertyFrameIndirect,OLEPRO32.DLL,NM,1,Creates a property frame, that is, aproperty sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters,rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreateStaticFromData,OLE32.DLL,NM,7,Creates a static object (containing only arepresentation, with no native data) from a data transfer object.OleDestroyMenuDescriptor,OLE32.DLL,NM,1,Called by the container to free the shared menudescriptor allocated by the OleCreateMenuDescriptor function.OleDoAutoConvert,OLE32.DLL,NM,2,Automatically converts an object to a new class ifautomatic conversion for that object class is set in the registry.OleDraw,OLE32.DLL,NM,4,The OleDraw helper function can be used to draw objects moreeasily. You can use it instead of calling IViewObject::Draw directly.OleDuplicateData,OLE32.DLL,NM,3,Duplicates the data found in the specified handle andreturns a handle to the duplicated data. The source data is in a clipboard format.OleFlushClipboard,OLE32.DLL,NM,0,Carries out the clipboard shutdown sequence. It alsoreleases the IDataObject pointer that was placed on the clipboard by the OleSetClipboardfunction.OleGetAutoConvert,OLE32.DLL,NM,2,Determines whether the registry is set for objects of aspecified CLSID to be automatically converted to another CLSID, and if so, retrieves the newCLSID.OleGetClipboard,OLE32.DLL,NM,1,Retrieves a data object that you can use to access thecontents of the clipboard.OleGetIconOfClass,OLE32.DLL,NM,3,Returns a handle to a metafile containing an icon and astring label for the specified CLSID.

OleGetIconOfFile,OLE32.DLL,NM,2,Returns a handle to a metafile containing an icon andstring label for the specified file name.OleIconToCursor,OLEAUT32.DLL,NM,2,Converts an icon to a cursor. For Win32 applications,this function calls the Win32 function CopyCursor(hIcon).OleIconToCursor,OLEPRO32.DLL,NM,2,Converts an icon to a cursor. For Win32 applications,this function calls the Win32 function CopyCursor(hIcon).OleInitialize,OLE32.DLL,NM,1,Initializes the COM library on the current apartment, identifiesthe concurrency model as single-thread apartment (STA), and enables additional functionalitydescribed in the Remarks section below.OleIsCurrentClipboard,OLE32.DLL,NM,1,Determines whether the data object pointer previouslyplaced on the clipboard by the OleSetClipboard function is still on the clipboard.OleIsRunning,OLE32.DLL,NM,1,This function determines whether a compound documentobject is currently in the running state.OleLoad,OLE32.DLL,NM,4,PicturePathCreates a new picture object and initializes it from thecontents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...) followedby IPersistStream::Load.OleLoadFromStream,OLE32.DLL,NM,3, Loads an object from the stream.OleLoadPicture,OLEAUT32.DLL,NM,5,PathCreates a new picture object and initializes it fromthe contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...)followed by IPersistStream::Load.OleLoadPicture,OLEPRO32.DLL,NM,5,PathCreates a new picture object and initializes it fromthe contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...)followed by IPersistStream::Load.OleLoadPicturePath,OLEAUT32.DLL,NM,6,Creates a new picture object and initializes it fromthe contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...)followed by IPersistStream::Load.OleLockRunning,OLE32.DLL,NM,3,Locks an already running object into its running state orunlocks it from its running state.OleMetafilePictFromIconAndLabel,OLE32.DLL,NM,4,Creates a METAFILEPICT structure thatcontains a metafile in which the icon and label are drawn.OleNoteObjectVisible,OLE32.DLL,NM,2,Increments or decrements an external reference thatkeeps an object in the running state.OleQueryCreateFromData,OLE32.DLL,NM,1,Checks whether a data object has one of theformats that would allow it to become an embedded object through a call to either theOleCreateFromData orOleQueryLinkFromData,OLE32.DLL,NM,1, determines whether an OLE linked object (ratherthan an OLE embedded object) can be created from a clipboard data object.OleRegEnumFormatEtc,OLE32.DLL,NM,3,Supplies a pointer to an enumeration object that canbe used to enumerate data formats that an OLE object server has registered in the systemregistry. An object application or object handler calls this function when it must enumerate thoseformats.OleRegEnumVerbs,OLE32.DLL,NM,2,Supplies an enumeration of the registered verbs for thespecified class. Developers of custom DLL object applications use this function to emulate thebehavior of the default object handler.OleRegGetMiscStatus,OLE32.DLL,NM,3,Gets miscellaneous information about thepresentation and behaviors supported by the specified CLSID from the registry. Used bydevelopers of custom DLL object applications to emulate the behavior of the OLE defaulthandler.OleRegGetUserType,OLE32.DLL,NM,3,Gets the user type of the specified class from theregistry. Developers of custom DLL object applications use this function to emulate the behaviorof the OLE default handler.OleRun,OLE32.DLL,NM,1, This function puts an OLE compound document object into therunning state.OleSave,OLE32.DLL,NM,3,ToStream Saves an object with the IPersistStream interface on it tothe specified stream.OleSaveToStream,OLE32.DLL,NM,2, Saves an object with the IPersistStream interface on it tothe specified stream.OleSaveToStreamEx,HLINK.DLL,NM,3, OleSaveToStreamEx Function Not currentlysupported.OleSetAutoConvert,OLE32.DLL,NM,2,Specifies a CLSID for automatic conversion to a differentclass when an object of that class is loaded.OleSetClipboard,OLE32.DLL,NM,1,Places a pointer to a specific data object onto the clipboard.This makes the data object accessible to the OleGetClipboard function.OleSetContainedObject,OLE32.DLL,NM,2, This function notifies an object embedded in anOLE container to ensure correct reference.OleSetMenuDescriptor,OLE32.DLL,NM,5, This function installs or removes OLE dispatchingcode from the containers frame window.OleTranslateAccelerator,OLE32.DLL,NM,3,Called by the object application, allows an object'scontainer to translate accelerators according to the container's accelerator table.OleTranslateColor,OLEAUT32.DLL,NM,3,Converts an OLE_COLOR type to a COLORREF.OleTranslateColor,OLEPRO32.DLL,NM,3,Converts an OLE_COLOR type to a COLORREF.OleUIAddVerbMenu,OLEDLG.DLL,AW,9,Adds the Verb menu for the specified object to thegiven menu.OleUIBusy,OLEDLG.DLL,AW,1, (COM)Invokes the standard Busy dialog box, allowing the userto manage concurrency.OleUICanConvertOrActivateAs,OLEDLG.DLL,NM,3,Determines if there are any OLE objectclasses in the registry that can be used to convert or activate the specified CLSID from.OleUIConvert,OLEDLG.DLL,AW,1, (COM)Invokes the standard Convert dialog box, allowingthe user to change the type of a single specified object, or the type of all OLE objects of thespecified object's class.OleUIObjectProperties,OLEDLG.DLL,AW,1,Invokes the Object Properties dialog box, whichdisplays General, View, and Link information about an object.OleUIUpdateLinks,OLEDLG.DLL,AW,4,Updates all links in the link container and displays adialog box that shows the progress of the updating process. The process is stopped if the userpresses the Stop button or when all links are processed.OleUninitialize,OLE32.DLL,NM,0,Closes the COM library on the apartment, releases any classfactories, other COM objects, or servers held by the apartment, disables RPC on the apartment,and frees any resources the apartment maintains.OpenBackupEventLog,ADVAPI32.DLL,AW,2, opens a handle of a backup event log.OpenClipboard,USER32.DLL,NM,1, opens the clipboard for examination and prevents otherapplications from modifying the clipboard content.OpenColorProfile,MSCMS.DLL,AW,4, creates a handle to a specified color profile. The handlecan then be used in other profile management functions.OpenDesktop,USER32.DLL,AW,4, returns a handle to an existing desktop.OpenEvent,KERNEL32.DLL,AW,3, returns a handle of an existing named event object.OpenEventLog,ADVAPI32.DLL,AW,2, opens a handle to an event log.OpenFile,KERNEL32.DLL,NM,3, creates, opens, reopens, or deletes a file.OpenFileMapping,KERNEL32.DLL,AW,3, opens a named file-mapping object.OpenIcon,USER32.DLL,NM,1, restores a minimized (iconic) window to its previous size andposition; it then activates the window.OpenIMsgOnIStg,MAPI32.DLL,NM,11 builds a new IMessage object on top ofan existing OLEIStorage object, to be used within a messagesession.OpenIMsgSession,MAPI32.DLL,NM,3 creates and opens a message session that groups themessages created within it.OpenInputDesktop,USER32.DLL,NM,3, returns a handle to the desktop that receives userinput.OpenMutex,KERNEL32.DLL,AW,3 returns a handle of an existing named mutex object.OpenNtmsNotification,NTMSAPI.DLL,NM,2, opens a channel to receive RSM object changenotifications for objects of the specified type.

Page 144: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

144OpenNtmsSession,NTMSAPI.DLL,AW,3, sets up a session with a RSM server.OpenPrinter,WINMM.DLL,AW,3 retrieves a handle identifying the specified printer or printserver.OpenProcess,KERNEL32.DLL,NM,3, returns a handle of an existing process object.OpenProcessToken,ADVAPI32.DLL,NM,3, opens the access token associated with a process.OpenSCManager,ADVAPI32.DLL,AW,3 establishes a connection to the service controlmanager on the specified computer and opens the specified service control manager database.OpenSemaphore,KERNEL32.DLL,AW,3, returns a handle of an existing named semaphoreobject.OpenService,ADVAPI32.DLL,AW,3, opens a handle to an existing service.OpenStreamOnFile,MAPI32.DLL,NM,6, allocates and initializes an OLE IStream object toaccess the contents of a file.OpenThreadToken,ADVAPI32.DLL,NM,4, opens the access token associated with a thread.OpenTnefStream,MAPI32.DLL,NM,7 is called by a transport provider toinitiate a MAPITransport Neutral Encapsulation Format (TNEF)session.OpenTnefStreamEx,MAPI32.DLL,NM,8 creates a TNEF object that can beused to encode ordecode a message object into a TNEF data streamfor use by transports or gateways andmessage stores.OpenWaitableTimer,KERNEL32.DLL,AW,3, returns a handle to an existing named ?waitable?timer object.OpenWindowStation,USER32.DLL,AW,3, returns a handle to an existing window station.OutputDebugString,KERNEL32.DLL,AW,1, sends a string to the debugger for the currentapplication.PackDDElParam,USER32.DLL,NM,3 packs a DDE lParam value into an internal structure usedfor sharing DDE data between processes.PageSetupDlg,COMDLG32.DLL,AW,1, creates a Page Setup dialog box that enables the userto specify the attributes of a printed page.PaintDesktop,USER32.DLL,NM,1, fills the clipping region in the specified device context withthe desktop pattern or wallpaper.PaintRgn,GDI32.DLL,NM,2, paints the specified region by using the brush currently selectedinto the device context.PatBlt,GDI32.DLL,NM,6, paints the given rectangle using the brush that is currently selectedinto the specified device context.PathToRegion,GDI32.DLL,NM,1, creates a region from the path that is selected into thespecified device context.PdhAddCounter,PDH.DLL,AW,4, creates the specified counter and adds it to the specifiedquery.PdhBrowseCounters,PDH.DLL,AW,1, displays the counter browsing dialog box so that the usercan select the counters to be returned to the caller.PdhCalculateCounterFromRawValue,PDH.DLL,NM,5, computes the current value of a counteras referenced by the hCounter parameter, using the raw counter data passed in the parameterlist.PdhCloseQuery,PDH.DLL,NM,1, closes all counters contained in the specified query, closes allhandles related to the query, and frees all memory associated with the query.PdhCollectQueryData,PDH.DLL,NM,1, collects the current raw data value for all counters in thespecified query and updates the status code of each counter.PdhComputeCounterStatistics,PDH.DLL,NM,6, computes statistics for a counter from an arrayof raw values.PdhConnectMachine,PDH.DLL,AW,1, connects to the specified computer, and creates andinitializes a computer entry in the PDH DLL.PdhEnumMachines,PDH.DLL,AW,3, returns a list of the names of the computers that havebeen opened previously by the PDH DLL.PdhEnumObjectItems,PDH.DLL,AW,9, returns the available counters and instances providedby the specified object on the specified computer.PdhEnumObjects,PDH.DLL,AW,6, returns a list of objects available on the specified computer.PdhExpandCounterPath,PDH.DLL,AW,3, examines the specified computer (or local computer ifnone is specified) for counters and instances of counters that match the wildcard strings in thecounter path.PdhGetCounterInfo,PDH.DLL,AW,4, retrieves information about a counter, such as data size,counter type, path, and user-supplied data values.PdhGetDefaultPerfCounter,PDH.DLL,AW,5, retrieves the name of the default counter for thespecified object. This name can be used to set the initial selection of the counter browserlist/combo box.PdhGetDefaultPerfObject,PDH.DLL,AW,4, retrieves the name of the default performanceobject. This name can be used to select the default entry in the object browser list box.PdhGetDllVersion,PDH.DLL,NM,1, returns the version of the currently installed Pdh.dll file.PdhGetFormattedCounterValue,PDH.DLL,NM,4, returns the current value of a specifiedcounter in the format requested by the caller.PdhGetRawCounterValue,PDH.DLL,NM,3, returns the current raw value of the counter.PdhMakeCounterPath,PDH.DLL,AW,4, creates a full counter path using the members specifiedin the structure passed in the parameter list.PdhOpenQuery,PDH.DLL,NM,3, creates and initializes a unique query structure that is used tomanage the collection of performance data.PdhParseCounterPath,PDH.DLL,AW,4, parses the elements of the counter path and stores theresults in the structure passed by the caller.PdhParseInstanceName,PDH.DLL,AW,6, parses the elements of an instance string and returnsthem in the buffers supplied by the caller.PdhRemoveCounter,PDH.DLL,NM,1, removes a counter from a query.PdhSetCounterScaleFactor,PDH.DLL,NM,2, sets the scale factor that is applied to thecalculated value of the specified counter when you request the formatted counter value. If thePDH_FMT_NOSCALE flag is set, then this scale factor is ignored.PdhValidatePath,PDH.DLL,AW,1, validates that the specified counter is present on thecomputer specified in the counter path.PdhVbAddCounter,PDH.DLL,NM,3, creates a counter entry in the specified query object, andreturns a handle to that counter upon successful completion.PdhVbCreateCounterPathList,PDH.DLL,NM,2, displays the performance counter browsingdialog box, which lets the user select several performance counters. Each selected counterpath must then be read using the PdhVbGetCounterPathFromList function.PdhVbGetCounterPathElements,PDH.DLL,NM,7, parses a fully qualified performance counterpath string into its individual elements.PdhVbGetCounterPathFromList,PDH.DLL,NM,3, copies the counter path referenced by theIndex parameter from a counter path list created by the user from the most recent call to thePdhVbCreateCounterPathList function.PdhVbGetDoubleCounterValue,PDH.DLL,NM,2, returns the current value of the specifiedcounter as a double-precision floating point value.PdhVbGetOneCounterPath,PDH.DLL,NM,4, displays a dialog box that lets the user browse theavailable performance counters and select one counter.PdhVbIsGoodStatus,PDH.DLL,NM,1, tests a status value to determine if it is a success orfailure code. If the status value is a successful one, then the return value will be nonzero. If it isa failure status code, the return value will be zero.PdhVbOpenQuery,PDH.DLL,NM,1, creates and initializes a unique query structure that is usedto manage the collection of performance data.PeekConsoleInput,KERNEL32.DLL,AW,4, reads data from the specified console input bufferwithout removing it from the buffer.PeekMessage,USER32.DLL,AW,5, checks a thread message queue for a message and placesthe message (if any) in the specified structure.PeekNamedPipe,KERNEL32.DLL,NM,6, copies data from a named or anonymous pipe into abuffer without removing it from the pipe.phoneClose,TAPI32.DLL,NM,1, closes the specified open phone device.

phoneConfigDialog,TAPI32.DLL,AW,3 causes the provider of the specified phone device todisplay a modal dialog box (attached to the application's hwndOwner parameter) that allows theuser to configure parameters related to the phone device specified by dwDeviceID.phoneDevSpecific,TAPI32.DLL,NM,3 is used as a general extension mechanism to enable aTelephony API implementation to provide features not described in the other TAPI functions.phoneGetButtonInfo,TAPI32.DLL,AW,3, returns information about the specified button.phoneGetData,TAPI32.DLL,NM,4 uploads the information from the specified location in theopen phone device to the specified buffer.phoneGetDevCaps,TAPI32.DLL,AW,5 queries a specified phone device to determine itstelephony capabilities.phoneGetDisplay,TAPI32.DLL,NM,2 returns the current contents of thespecified phone display.phoneGetGain,TAPI32.DLL,NM,3, returns the gain setting of the microphone of the specifiedphone's hookswitch device.phoneGetHookSwitch,TAPI32.DLL,NM,2, returns the current hookswitch mode of the specifiedopen phone device.phoneGetIcon,TAPI32.DLL,AW,3 allows an application to retrieve a service phone device-specific (or provider-specific) icon that can be displayed to the user.phoneGetID,TAPI32.DLL,AW,3, can be used to retrieve a phone device identifier given a phonehandle.phoneGetLamp,TAPI32.DLL,NM,3, returns the current lamp mode of the specified lamp.phoneGetMessage,TAPI32.DLL,NM,3 returns the next TAPI message that is queued fordelivery to an application that is using the Event Handle notification mechanismphoneGetRing,TAPI32.DLL,NM,3, enables an application to query the specified open phonedevice as to its current ring mode.phoneGetStatus,TAPI32.DLL,AW,2, enables an application to query the specified open phonedevice for its overall status.phoneGetStatusMessages,TAPI32.DLL,NM,4 returns which phone-state changes on thespecified phone device generate a callback to the application.phoneGetVolume,TAPI32.DLL,NM,3, returns the volume setting of the specified phone'shookswitch device.phoneInitialize,TAPI32.DLL,NM,5 is obsolete.phoneInitializeEx,TAPI32.DLL,AW,7, initializes the application's use of TAPI for subsequent useof the phone abstraction.phoneNegotiateAPIVersion,TAPI32.DLL,NM,6, is used to negotiate the API version number touse with the specified phone device.phoneNegotiateExtVersion,TAPI32.DLL,NM,6 allows an application to negotiate an extensionversion to use with the specified phone device.phoneOpen,TAPI32.DLL,NM,7, opens the specified phone device.phoneSetButtonInfo,TAPI32.DLL,AW,3, sets information about the specified button on thespecified phone.phoneSetData,TAPI32.DLL,NM,4 downloads the information in thespecified buffer to theopened phone device at the selected dataidentifier.phoneSetDisplay,TAPI32.DLL,NM,5, causes the specified string to be displayed on thespecified open phone device.phoneSetGain,TAPI32.DLL,NM,3, sets the gain of the microphone of the specified hookswitchdevice to the specified gain level.phoneSetHookSwitch,TAPI32.DLL,NM,3 sets the hook state of thes pecified open phone'shookswitch devices to the specified mode.phoneSetLamp,TAPI32.DLL,NM,3, causes the specified lamp to be lit on the specified openphone device in the specified lamp mode.phoneSetRing,TAPI32.DLL,NM,3, rings the specified open phone device using the specifiedring mode and volume.phoneSetStatusMessages,TAPI32.DLL,NM,4 enables an application to monitor the specifiedphone device for selected status events.phoneSetVolume,TAPI32.DLL,NM,3 sets the volume of the speakercomponent of the specifiedhookswitch device to the specifiedlevel.phoneShutdown,TAPI32.DLL,NM,1, shuts down the application's usage of TAPI's phoneabstraction.Pie,GDI32.DLL,NM,9, draws a pie-shaped wedge bounded by the intersection of an ellipse andtwo radials.PlayEnhMetaFile,GDI32.DLL,NM,3, displays the picture stored in the specified enhanced-format metafile.PlayEnhMetaFileRecord,GDI32.DLL,NM,4 plays an enhanced-metafile record by executing thegraphics device interface (GDI) functions identified by the record.PlayMetaFile,GDI32.DLL,NM,2, displays the picture stored in the given Windows-formatmetafile on the specified device.PlayMetaFileRecord,GDI32.DLL,NM,4 plays a Windows-format metafilerecord by executing thegraphics device interface (GDI) functioncontained within that record.PlaySound,WINMM.DLL,AW,3, plays a sound specified by the given filename, resource, orsystem event.PlgBlt,GDI32.DLL,NM,10 performs a bit-block transfer of the bits of color data from thespecified rectangle in the source device context to the specified parallelogram in the destinationdevice context.PolyBezier,GDI32.DLL,NM,3, draws one or more B? er curves.PolyBezierTo,GDI32.DLL,NM,3, draws one or more B? er curves.PolyDraw,GDI32.DLL,NM,4 draws a set of line segments and Bezier curves.Polygon,GDI32.DLL,NM,3, draws a polygon consisting of two or more vertices connected bystraight lines.Polyline,GDI32.DLL,NM,3, draws a series of line segments by connecting the points in thespecified array.PolylineTo,GDI32.DLL,NM,3 draws one or more straight lines.PolyPolygon,GDI32.DLL,NM,4, draws a series of closed polygons.PolyPolyline,GDI32.DLL,NM,4, draws multiple series of connected line segments.PolyTextOut,GDI32.DLL,AW,3, draws several strings using the font and text colors currentlyselected in the specified device context.PostMessage,USER32.DLL,AW,4 places (posts) a message in the message queue associatedwith the thread that created the specified window and then returns without waiting for the threadto process the message.PostQueuedCompletionStatus,KERNEL32.DLL,NM,4, lets you post an I/O completion packet toan I/O completion port.PostQuitMessage,USER32.DLL,NM,1, indicates to Windows that a thread has made a requestto terminate (quit).PostThreadMessage,USER32.DLL,AW,4 places (posts) a message in the message queue ofthe specified thread and then returns without waiting for the thread to process the message.PpropFindProp,MAPI32.DLL,NM,3, searches for a specified property in a property set.PrepareTape,KERNEL32.DLL,NM,3 prepares the tape to be accessed or removed.PrintDlg,COMDLG32.DLL,AW,1,PDERR_CREATEICFAILURE failed when it attempted tocreate an information context.PrinterMessageBox,WINMM.DLL,AW,6 displays a message box that lets an application that isprinting notify the user of a printing job error.PrinterProperties,WINMM.DLL,NM,2, displays a printer-properties dialog box for the specifiedprinter.PrivilegeCheck,ADVAPI32.DLL,NM,3, determines whether a specified set of privileges areenabled in an access token.PrivilegedServiceAuditAlarm,ADVAPI32.DLL,AW,5 generates audit messages when an attemptis made to perform privileged system service operations.Process32First,TOOLHELP.DLL,NM,2,Retrieves information about the first processencountered in a system snapshot.

Page 145: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

145Process32Next,TOOLHELP.DLL,NM,2,Retrieves information about the next process recordedin a system snapshot.ProcessGroupPolicyCompleted,USERENV.DLL,NM,3, notifies the system that the specifiedextension has finished applying policy.ProgIDFromCLSID,OLE32.DLL,NM,2,This function retrieves the ProgID for a given CLSID.PropCopyMore,MAPI32.DLL,NM,4 copies a single property value from a source location to adestination location.PropertySheet,COMCTL32.DLL,AW,1, creates a property sheet and adds the pages defined inthe specified property sheet header structure.PropStgNameToFmtId,IPROP.DLL,NM,2,Converts a property set storage or stream name to itsformat identifier.PropVariantClear,IPROP.DLL,NM,1,Frees all elements that can be freed in a givenPROPVARIANT structure.PropVariantClear,OLE32.DLL,NM,1,Frees all elements that can be freed in a givenPROPVARIANT structure.PropVariantCopy,IPROP.DLL,NM,2, copies the contents of one PROPVARIANT structure toanother.PropVariantCopy,OLE32.DLL,NM,2, copies the contents of one PROPVARIANT structure toanother.PtInRect,USER32.DLL,NM,3, determines whether the specified point lies within the specifiedrectangle.PtInRegion,GDI32.DLL,NM,3, determines whether the specified point is inside the specifiedregion.PtVisible,GDI32.DLL,NM,3, indicates whether the specified point is within the clipping region ofa device context.PulseEvent,KERNEL32.DLL,NM,1 provides a single operation that sets (to signaled) the stateof the specified event object and then resets it (to nonsignaled) after releasing the appropriatenumber of waiting threads.PurgeComm,KERNEL32.DLL,NM,2, can discard all characters from the output or input buffer ofa specified communications resource.QueryContextAttributes,SECUR32.DLL,AW,3,Enables a transport application to query asecurity package for certain attributes of a security context.QueryCredentialsAttributes,SECUR32.DLL,AW,3, retrieves the attributes of a credential, suchas the name associated with the credential. The information is valid for any security contextcreated with the specified credential.QueryDosDevice,KERNEL32.DLL,AW,3, lets an application obtain information about MS-DOSdevice names.QueryPathOfRegTypeLib,OLEAUT32.DLL,NM,5,Retrieves the path of a registered type library.QueryPerformanceCounter,KERNEL32.DLL,NM,1, retrieves the current value of the high-resolution performance counter, if one exists.QueryPerformanceFrequency,KERNEL32.DLL,NM,1, retrieves the frequency of the high-resolution performance counter, if one exists.QuerySecurityContextToken,SECUR32.DLL,NM,2,Obtains the access token for a client securitycontext and uses it directly.QuerySecurityPackageInfo,SECUR32.DLL,AW,2, retrieves information about a specifiedsecurity package. This information includes the bounds on sizes of authentication information,credentials, and contexts.QueryServiceConfig,ADVAPI32.DLL,AW,4, retrieves the configuration parameters of thespecified service.QueryServiceLockStatus,ADVAPI32.DLL,AW,4 retrieves the lock status of the specified servicecontrol manager database.QueryServiceObjectSecurity,ADVAPI32.DLL,NM,5, retrieves a copy of the security descriptorassociated with a service object.QueryServiceStatus,ADVAPI32.DLL,NM,2, retrieves the current status of the specified service.QueryWorkingSet,PSAPI.DLL,NM,3, retrieves information about the pages currently added tothe working set of the specified process.QueueUserAPC,KERNEL32.DLL,NM,3, adds a user-mode asynchronous procedure call (APC)object to the APC queue of the specified thread.RaiseException,KERNEL32.DLL,NM,4, raises an exception in the calling thread.RasAdminFreeBuffer,RASSAPI.DLL,NM,1, frees memory that was allocated by frees memorythat was allocated by RAS on behalf of the caller.RasAdminGetErrorString,RASSAPI.DLL,NM,3 corresponds to a RAS error code returned byone of the RAS serveradministration (RasAdmin) functions.RasAdminGetUserAccountServer,RASSAPI.DLL,NM,3, retrieves the name of the server thathas the user account database.RasAdminPortClearStatistics,RASSAPI.DLL,NM,2 resets the countersrepresenting the variousstatistics reported by theRasAdminPortGetInfo function in the RAS_PORT_STATISTICSstructure.RasAdminPortDisconnect,RASSAPI.DLL,NM,2, disconnects a port that is currently in use.RasAdminPortEnum,RASSAPI.DLL,NM,3 enumerates all ports on the specifiedRAS server.RasAdminPortGetInfo,RASSAPI.DLL,NM,5, retrieves information about a specified port on aspecified server.RasAdminServerGetInfo,RASSAPI.DLL,NM,2, gets the server configuration of a RAS server.RasAdminUserGetInfo,RASSAPI.DLL,NM,3, gets the RAS permissions and callback phonenumber information for a specified user.RasAdminUserSetInfo,RASSAPI.DLL,NM,3 sets the RAS permissions and call-back phonenumber for a specified user.RasConnectionNotification,RASAPI32.DLL,AW,3 specifies an event objectthat the system setsto the signaled state when a RAS connection iscreated or terminated.RasCreatePhonebookEntry,RASAPI32.DLL,AW,2, creates a new phone-book entry.RasDeleteEntry,RASAPI32.DLL,AW,2, deletes an entry from a phone book.RasDial,RASAPI32.DLL,AW,6, establishes a RAS connection between a RAS client and a RASserver.RasDialDlg,RASDLG.DLL,AW,4 tries to establish a RAS connection using a specified phone-book entry and the credentials of the logged-on user.RasEditPhonebookEntry,RASAPI32.DLL,AW,3, edits an existing phone-book entry.RasEntryDlg,RASDLG.DLL,AW,3, displays modal property sheets that allow a user tomanipulate phone-book entries.RasEnumAutodialAddresses,RASAPI32.DLL,AW,3 returns a list of all addresses in theAutoDial mapping database.RasEnumConnections,RASAPI32.DLL,AW,3, lists all active RAS connections.RasEnumDevices,RASAPI32.DLL,AW,3, returns the name and type of all available RAS-capable devices.RasEnumEntries,RASAPI32.DLL,AW,5, lists all entry names in a remote access phone book.RasGetAutodialAddress,RASAPI32.DLL,AW,5 retrieves information about allthe AutoDialentries associated with a network address in theAutoDial mapping database.RasGetAutodialEnable,RASAPI32.DLL,AW,2, indicates whether the AutoDial feature is enabledfor a specified TAPI dialing location.RasGetAutodialParam,RASAPI32.DLL,AW,3, retrieves the value of an AutoDial parameter.RasGetConnectStatus,RASAPI32.DLL,AW,2, retrieves information on the current status of thespecified remote access connection.RasGetCountryInfo,RASAPI32.DLL,AW,2, retrieves country-specific dialing information fromthe Windows Telephony list of countries.RasGetCredentials,RASAPI32.DLL,AW,3, retrieves the user credentials associated with aspecified RAS phone-book entry.RasGetEntryDialParams,RASAPI32.DLL,AW,3, retrieves the connection information saved bythe last successful call to the RasDial or RasGetEntryDialParams function for a specified phonebook entry.RasGetEntryProperties,RASAPI32.DLL,AW,6 retrieves the properties of aphone-book entry.

RasGetErrorString,RASAPI32.DLL,AW,3, obtains an error message string for a specified RASerror value.RasGetProjectionInfo,RASAPI32.DLL,AW,4 obtains information about aremote accessprojection operation for a specified remote accesscomponent protocol.RasGetSubEntryHandle,RASAPI32.DLL,AW,3 retrieves a connection handle for a specifiedsubentry of a multilink connection.RasGetSubEntryProperties,RASAPI32.DLL,AW,7, retrieves information about a subentry for aspecified phone-book entry.RasHangUp,RASAPI32.DLL,AW,1, terminates a remote access connection.RasMonitorDlg,RASDLG.DLL,AW,2, displays the Dial-Up Networking Monitor property sheetthat describes the status of RAS connections.RasRenameEntry,RASAPI32.DLL,AW,3, changes the name of an entry in a phone book.RasSetAutodialAddress,RASAPI32.DLL,AW,5, can add an address to the AutoDial mappingdatabase.RasSetAutodialEnable,RASAPI32.DLL,AW,2, enables or disables the AutoDial feature for aspecified TAPI dialing location.RasSetAutodialParam,RASAPI32.DLL,AW,3, sets the value of an AutoDial parameter.RasSetCredentials,RASAPI32.DLL,AW,4, sets the user credentials associated with a specifiedRAS phone-book entry.RasSetEntryDialParams,RASAPI32.DLL,AW,3 deletes an entry from a phone book.RasSetEntryProperties,RASAPI32.DLL,AW,6 changes the connectioninformation for an entry inthe phone book or creates a new phone-book entry.RasSetSubEntryProperties,RASAPI32.DLL,AW,7, creates a new subentry or modifies anexisting subentry of a specified phone-book entry.RasValidateEntryName,RASAPI32.DLL,AW,2, validates the format of a connection entry name.ReadClassStg,OLE32.DLL,NM,2, reads the CLSID previously written to a storage object withthe WriteClassStg function.ReadClassStm,OLE32.DLL,NM,2,Reads the CLSID previously written to a stream object withthe WriteClassStm function.ReadConsole,KERNEL32.DLL,AW,5, reads character input from the console input buffer andremoves it from the buffer.ReadConsoleInput,KERNEL32.DLL,AW,4, reads data from a console input file buffer andremoves it from the buffer.ReadConsoleOutput,KERNEL32.DLL,AW,5 reads character and color attribute data from arectangular block of character cells in a console screen buffer, and the function writes the datato a rectangular block at a specified location in the destination buffer.ReadConsoleOutputAttribute,KERNEL32.DLL,NM,5 copies a specified number of foregroundand background color attributes from consecutive cells of a console screen buffer, beginning ata specified location.ReadConsoleOutputCharacter,KERNEL32.DLL,AW,5 copies a number ofcharacters fromconsecutive cells of a console screen buffer,beginning at a specified location.ReadEventLog,ADVAPI32.DLL,AW,7, reads a whole number of entries from the specified eventlog.ReadFile,KERNEL32.DLL,NM,5, reads data from a file, starting at the position indicated by thefile pointer.ReadFileEx,KERNEL32.DLL,NM,5,ERROR_HANDLE_EOF tried to read past the end of thefile.ReadFmtUserTypeStg,OLE32.DLL,NM,3, returns the clipboard format and user type previouslysaved with the WriteFmtUserTypeStg function.ReadPrinter,WINMM.DLL,NM,4, retrieves data from the specified printer.ReadProcessMemory,KERNEL32.DLL,NM,5, reads memory in a specified process.ReadUrlCacheEntryStream,WININET.DLL,NM,5,Reads the cached data from a stream that hasbeen opened using the RetrieveUrlCacheEntryStream function.RealizePalette,GDI32.DLL,NM,1, maps palette entries from the current logical palette to thesystem palette.ReBaseImage,IMAGEHLP.DLL,NM,11, is used to change the load address for the specifiedimage, which reduces the required load time for a DLL.Rectangle,GDI32.DLL,NM,5 draws a rectangle.RectInRegion,GDI32.DLL,NM,2, determines whether any part of the specified rectangle iswithin the boundaries of a region.RectVisible,GDI32.DLL,NM,2 determines whether any part of thespecified rectangle lies withinthe clipping region of a devicecontext.recv,WS2_32.DLL,NM,4,Receives data from a connected or bound socket.recv,WSOCK32.DLL,NM,4,Receives data from a connected or bound socket.recvfrom,WS2_32.DLL,NM,6 receives a datagram and stores the source address.recvfrom,WSOCK32.DLL,NM,6 receives a datagram andstores the source address.RedrawWindow,USER32.DLL,NM,4, updates the specified rectangle or region in a window?sclient area.RefreshPolicy,USERENV.DLL,NM,1, causes policy to be applied immediately on the clientcomputer.RegCloseKey,ADVAPI32.DLL,NM,1 releases the handle of the specified key.RegConnectRegistry,ADVAPI32.DLL,AW,3, establishes a connection to a predefined registryhandle on another computer.RegCreateKey,ADVAPI32.DLL,AW,3, creates the specified key.RegCreateKeyEx,ADVAPI32.DLL,AW,9, creates the specified key.RegDeleteKey,ADVAPI32.DLL,AW,2,Windows 95: deletes a subkey and all its descendants.RegDeleteValue,ADVAPI32.DLL,AW,2 removes a named value from the specified registry key.RegEnumKey,ADVAPI32.DLL,AW,4, enumerates subkeys of the specified open registry key.RegEnumKeyEx,ADVAPI32.DLL,AW,8, enumerates subkeys of the specified open registry key.RegEnumValue,ADVAPI32.DLL,AW,8, enumerates the values for the specified data block forthe key each time it is called.RegFlushKey,ADVAPI32.DLL,NM,1, writes all the attributes of the specified open key into theregistry.RegGetKeySecurity,ADVAPI32.DLL,NM,4, retrieves a copy of the security descriptor protectingthe specified open registry key.RegisterActiveObject,OLEAUT32.DLL,NM,4,Registers an object as the active object for itsclass.RegisterBindStatusCallback,URLMON.DLL,NM,4, Registers a callback interface with anexisting bind context.RegisterClass,USER32.DLL,AW,1, registers a window class for subsequent use in calls to theCreateWindow or CreateWindowEx function.RegisterClassEx,USER32.DLL,AW,1 registers a window class for subsequent use in calls tothe CreateWindow or CreateWindowEx function.RegisterClipboardFormat,USER32.DLL,AW,1, registers a new clipboard format.RegisterCMM,MSCMS.DLL,AW,3,RegisterCMM associates a specified identification value withthe specified color management module dynamic link library (CMM DLL). When this ID appearsin a color profile, Windows can then locate the corresponding CMM so as to create a transform.RegisterDragDrop,OLE32.DLL,NM,2,Registers the specified window as one that can be thetarget of an OLE drag-and-drop operation and specifies the IDropTarget instance to use fordrop operations.RegisterEventSource,ADVAPI32.DLL,AW,2, returns a registered handle to an event log.RegisterFormatEnumerator,URLMON.DLL,NM,3, Registers a FORMATETC enumerator objectonto the given bind context.RegisterGPNotification,USERENV.DLL,NM,2, enables an application to receive notificationwhen there is a change in policy. When a policy change occurs, the specified event object is setto the signaled state.RegisterHotKey,USER32.DLL,NM,4, defines a system-wide hot key.RegisterMediaTypeClass,URLMON.DLL,NM,5, Registers a mapping of media types to CLSIDsto override the default mapping specified in the registry.

Page 146: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

146RegisterMediaTypes,URLMON.DLL,NM,3, Registers media type strings.RegisterServiceCtrlHandler,ADVAPI32.DLL,AW,2 A Win32-based service calls theRegisterServiceCtrlHandler functionto register a function to handle its service control requests.RegisterWindowMessage,USER32.DLL,AW,1 defines a new window messagethat isguaranteed to be unique throughout the system.RegLoadKey,ADVAPI32.DLL,AW,3 creates a subkey under HKEY_USERorHKEY_LOCAL_MACHINE and stores registration information from aspecified file into thatsubkey.RegNotifyChangeKeyValue,ADVAPI32.DLL,NM,5, notifies the caller about changes to theattributes or contents of a specified registry key.RegOpenKey,ADVAPI32.DLL,AW,3, opens the specified key.RegOpenKeyEx,ADVAPI32.DLL,AW,5 opens the specified key.RegQueryInfoKey,ADVAPI32.DLL,AW,12, retrieves information about a specified registry key.RegQueryMultipleValues,ADVAPI32.DLL,AW,5, retrieves the type and data for a list of valuenames associated with an open registry key.RegQueryValue,ADVAPI32.DLL,AW,4, retrieves the value associated with the unnamed valuefor a specified key in the registry.RegQueryValueEx,ADVAPI32.DLL,AW,6, retrieves the type and data for a specified valuename associated with an open registry key.RegReplaceKey,ADVAPI32.DLL,AW,4 replaces the file backing a key and all its subkeys withanother file, so that when the system is next started, the key and subkeys will have the valuesstored in the new file.RegRestoreKey,ADVAPI32.DLL,AW,3 reads the registry information in a specified file andcopies it over the specified key.RegSaveKey,ADVAPI32.DLL,AW,3, saves the specified key and all of its subkeys and valuesto a new file.RegSetKeySecurity,ADVAPI32.DLL,NM,3 sets the security of an open registry key.RegSetValue,ADVAPI32.DLL,AW,5, associates a value with a specified key.RegSetValueEx,ADVAPI32.DLL,AW,6, stores data in the value field of an open registry key.RegUnLoadKey,ADVAPI32.DLL,AW,2, unloads the specified key and subkeys from theregistry.ReleaseCapture,USER32.DLL,NM,0 releases the mouse capture from awindow in the currentthread and restores normal mouse inputprocessing.ReleaseDC,USER32.DLL,NM,2, releases a device context (DC), freeing it for use by otherapplications.ReleaseMutex,KERNEL32.DLL,NM,1, fails if the calling thread does not own the mutex object.ReleaseNtmsCleanerSlot,NTMSAPI.DLL,NM,2, removes an existing slot reservation for acleaning cartridge. The slot can then be used for data cartridges.ReleaseSemaphore,KERNEL32.DLL,NM,3, increases the count of the specified semaphoreobject by a specified amount.ReleaseStgMedium,OLE32.DLL,NM,1,Frees the specified storage medium.RemoveDirectory,KERNEL32.DLL,AW,1, deletes an existing empty directory.RemoveFontResource,GDI32.DLL,AW,1, removes the fonts in the specified file from theWindows font table.RemoveMenu,USER32.DLL,NM,3, deletes a menu item from the specified menu.RemoveProp,USER32.DLL,AW,2, removes an entry from the property list of the specifiedwindow.ReplaceText,COMDLG32.DLL,AW,1 creates a system-defined modeless dialog box that letsthe user specify a string to search for and a replacement string, as well as options to control thefind and replace operations.ReplyMessage,USER32.DLL,NM,1 is used to reply to a message sentthrough theSendMessage function without returning control to thefunction that called SendMessage.ReportEvent,ADVAPI32.DLL,AW,9, writes an entry at the end of the specified event log.ReserveNtmsCleanerSlot,NTMSAPI.DLL,NM,3, reserves a single slot in a library unit for a drivecleaner cartridge.ResetDC,GDI32.DLL,AW,2, cannot be used to change the driver name, device name, or theoutput port.ResetEvent,KERNEL32.DLL,NM,1, sets the state of the specified event object to nonsignaled.ResetPrinter,WINMM.DLL,AW,2 lets an application specify the data typeand device modevalues that are used for printing documentssubmitted by the StartDocPrinter function.ResizePalette,GDI32.DLL,NM,2, increases or decreases the size of a logical palette based onthe specified value.RestoreDC,GDI32.DLL,NM,2, restores a device context (DC) to the specified state.ResumeSuspendedDownload,WININET.DLL,NM,2, resumes a request that is suspended by auser interface dialog box.ResumeThread,KERNEL32.DLL,NM,1, decrements a thread?s suspend count.ResUtilAddUnknownProperties,RESUTILS.DLL,NM,6,The ResUtilAddUnknownProperties utilityfunction retrieves a set of unknown properties from the cluster database and appends them tothe end of a property list.ResUtilCreateDirectoryTree,RESUTILS.DLL,NM,1, creates every directory specified in a path,skipping directories that already exist.ResUtilDupParameterBlock,RESUTILS.DLL,NM,3,The ResUtilDupParameterBlock utilityfunction performs a member-wise copy of the data from one parameter block to another.ResUtilDupString,RESUTILS.DLL,NM,1,The ResUtilDupString utility function duplicates a null-terminated Unicode string.ResUtilEnumPrivateProperties,RESUTILS.DLL,NM,5,The ResUtilEnumPrivateProperties utilityfunction retrieves the names of a cluster object's private properties.ResUtilEnumProperties,RESUTILS.DLL,NM,5,The ResUtilEnumProperties utility functionenumerates the property names of a cluster object.ResUtilEnumResources,RESUTILS.DLL,NM,4,The ResUtilEnumResources utility functionenumerates all of the resources in the local cluster and initiates a user-defined operation foreach resource.ResUtilExpandEnvironmentStrings,RESUTILS.DLL,NM,1, expands strings containingunexpanded references to environment variables.ResUtilFindBinaryProperty,RESUTILS.DLL,NM,5,The ResUtilFindBinaryProperty utility functionlocates a specified binary property in a property list and can also return the value of theproperty.ResUtilFindDependentDiskResourceDriveLetter,RESUTILS.DLL,NM,4,TheResUtilFindDependentDiskResourceDriveLetter utility function retrieves the drive letterassociated with a Physical Disk dependency of a resource.ResUtilFindDwordProperty,RESUTILS.DLL,NM,4,The ResUtilFindDwordProperty utility functionlocates an unsigned long property value in a property list.ResUtilFindExpandedSzProperty,RESUTILS.DLL,NM,4,The ResUtilFindExpandedSzPropertyutility function locates an expanded string property value in a property list.ResUtilFindExpandSzProperty,RESUTILS.DLL,NM,4,The ResUtilFindExpandSzProperty utilityfunction locates an expandable string property in a property list.ResUtilFindLongProperty,RESUTILS.DLL,NM,4,The ResUtilFindLongProperty utility functionlocates a signed long property value in a property list.ResUtilFindMultiSzProperty,RESUTILS.DLL,NM,5,The ResUtilFindMultiSzProperty utilityfunction locates a multiple string property in a property list.ResUtilFindSzProperty,RESUTILS.DLL,NM,4,The ResUtilFindSzProperty utility function locatesa string property in a property list.ResUtilFreeEnvironment,RESUTILS.DLL,NM,1, destroys the environment variable blockcreated with ResUtilGetEnvironmentWithNetName.ResUtilFreeParameterBlock,RESUTILS.DLL,NM,3,The ResUtilFreeParameterBlock utilityfunction deallocates memory that has been allocated for a parameter block byResUtilDupParameterBlock.ResUtilGetAllProperties,RESUTILS.DLL,NM,6,The ResUtilGetAllProperties utility functionreturns a property list that includes all of the default and unknown properties for a cluster object.

ResUtilGetBinaryProperty,RESUTILS.DLL,NM,7,The ResUtilGetBinaryProperty utility functionretrieves a binary property from a property list and advances a pointer to the next property inthe list.ResUtilGetBinaryValue,RESUTILS.DLL,NM,4,The ResUtilGetBinaryValue utility functionreturns a binary value from the cluster database.ResUtilGetDwordProperty,RESUTILS.DLL,NM,7,The ResUtilGetDwordProperty utility functionretrieves a DWORD property from a property list and advances a pointer to the next property inthe list.ResUtilGetDwordValue,RESUTILS.DLL,NM,4,The ResUtilGetDwordValue utility functionreturns a numeric value from the cluster database.ResUtilGetEnvironmentWithNetName,RESUTILS.DLL,NM,1, adjusts environment data for aresource so that the resource uses a cluster network name to identify its location. The resourcemust be dependent on a Network Name resource.ResUtilGetMultiSzProperty,RESUTILS.DLL,NM,7,The ResUtilGetMultiSzProperty utility functionretrieves a multiple string property from a property list and advances a pointer to the nextproperty in the list.ResUtilGetPrivateProperties,RESUTILS.DLL,NM,5,The ResUtilGetPrivateProperties utilityfunction returns private properties for a cluster object.ResUtilGetProperties,RESUTILS.DLL,NM,6,The ResUtilGetProperties utility function retrievesproperties specified by a property table from the cluster database and returns them in aproperty list.ResUtilGetPropertiesToParameterBlock,RESUTILS.DLL,NM,5,TheResUtilGetPropertiesToParameterBlock utility function retrieves properties specified by aproperty table from the cluster database and returns them in a parameter block.ResUtilGetProperty,RESUTILS.DLL,NM,4,The ResUtilGetPropertySize utility function returnsthe total number of bytes required for a specified property.ResUtilGetPropertySize,RESUTILS.DLL,NM,4,The ResUtilGetPropertySize utility functionreturns the total number of bytes required for a specified property.ResUtilGetResourceDependency,RESUTILS.DLL,NM,2, enumerates the dependencies of aspecified resource and returns a handle to a dependency of a specified type.ResUtilGetResourceDependencyByClass,RESUTILS.DLL,NM,4, enumerates the dependenciesof a specified resource in a specified cluster and returns a handle to a dependency thatmatches a specified resource class.ResUtilGetResourceDependencyByName,RESUTILS.DLL,NM,4, enumerates thedependencies of a specified resource in a specified cluster and returns a handle to adependency of a specified type.ResUtilGetResourceDependentIPAddressProps,RESUTILS.DLL,NM,7,TheResUtilGetResourceDependentIPAddressProps utility function retrieves the private propertiesof the first IP Address dependency found for a specified resource.ResUtilGetResourceNameDependency,RESUTILS.DLL,NM,2, enumerates the dependenciesof a specified resource in the local cluster and returns a handle to a dependency of a specifiedresource type.ResUtilGetSzProperty,RESUTILS.DLL,NM,5,The ResUtilGetSzProperty utility function retrievesa string property from a property list and advances a pointer to the next property in the list.ResUtilGetSzValue,RESUTILS.DLL,NM,2,The ResUtilGetSzValue utility function returns astring value from the cluster database.ResUtilIsPathValid,RESUTILS.DLL,NM,1,The ResUtilIsPathValid utility function is used tocheck whether a path is syntactically valid.ResUtilIsResourceClassEqual,RESUTILS.DLL,NM,2, tests whether the resource class of aspecified resource is equal to a specified resource class.ResUtilPropertyListFromParameterBlock,RESUTILS.DLL,NM,6,TheResUtilPropertyListFromParameterBlock utility function constructs a property list from aproperty table and a parameter block.ResUtilResourcesEqual,RESUTILS.DLL,NM,2,The ResUtilResourcesEqual utility function testswhether two resource handles represent the same resource.ResUtilResourceTypesEqual,RESUTILS.DLL,NM,2,The ResUtilResourceTypesEqual utilityfunction tests whether a resource type matches the resource type name of a specified resource.ResUtilSetBinaryValue,RESUTILS.DLL,NM,6,The ResUtilSetBinaryValue utility function sets abinary value in the cluster database.ResUtilSetDwordValue,RESUTILS.DLL,NM,4,The ResUtilSetDwordValue utility function sets anumeric value in the cluster database.ResUtilSetExpandSzValue,RESUTILS.DLL,NM,4,The ResUtilSetExpandSzValue utility functionsets an expandable string value in the cluster database.ResUtilSetMultiSzValue,RESUTILS.DLL,NM,6,The ResUtilSetMultiSzValue utility function setsa multiple string value in the cluster database.ResUtilSetPrivatePropertyList,RESUTILS.DLL,NM,3,The ResUtilSetPrivatePropertyList utilityfunction sets the private properties of a cluster object.ResUtilSetPropertyParameterBlock,RESUTILS.DLL,NM,7,TheResUtilSetPropertyParameterBlock utility function is used to set properties in the clusterdatabase from a parameter block.ResUtilSetPropertyParameterBlockEx,RESUTILS.DLL,NM,8,TheResUtilSetPropertyParameterBlockEx utility function is used to set properties in the clusterdatabase from a parameter block.ResUtilSetPropertyTable,RESUTILS.DLL,NM,7,The ResUtilSetPropertyTable utility function isused to set properties in the cluster database based on a property list from a property table..ResUtilSetPropertyTableEx,RESUTILS.DLL,NM,8,The ResUtilSetPropertyTableEx utilityfunction is used to set properties in the cluster database based on a property list from aproperty table.ResUtilSetResourceServiceEnvironment,RESUTILS.DLL,NM,4, adjusts the environment datafor a service so that the service uses a cluster network name to identify its location. Thisfunction must be called from a resource DLL.ResUtilSetResourceServiceStartParameters,RESUTILS.DLL,NM,5, adjusts the startparameters of a specified service so that it will operate correctly as a cluster resource. It mustbe called from a resource DLL.ResUtilSetSzValue,RESUTILS.DLL,NM,4,The ResUtilSetSzValue utility function sets a stringvalue in the cluster database.ResUtilSetUnknownProperties,RESUTILS.DLL,NM,4,The ResUtilSetUnknownProperties utilityfunction stores a cluster object's unknown properties in the cluster database.ResUtilStartResourceService,RESUTILS.DLL,NM,2,The ResUtilStartResourceService utilityfunction starts a service.ResUtilStopResourceService,RESUTILS.DLL,NM,1,The ResUtilStopResourceService utilityfunction stops a named service.ResUtilStopService,RESUTILS.DLL,NM,1,The ResUtilStopService utility function stops aservice identified by a handle.ResUtilVerifyPrivatePropertyList,RESUTILS.DLL,NM,2,The ResUtilVerifyPrivatePropertyListutility function verifies that a property list is correctly formatted.ResUtilVerifyPropertyTable,RESUTILS.DLL,NM,6,The ResUtilVerifyPropertyTable utilityfunction uses a property table to verify that a property list is correctly formatted.ResUtilVerifyResourceService,RESUTILS.DLL,NM,1,The ResUtilVerifyResourceService utilityfunction verifies that a named service is starting or currently running.ResUtilVerifyService,RESUTILS.DLL,NM,1,The ResUtilVerifyService utility function checks if aservice identified by a handle is starting or currently running.RetrieveUrlCacheEntryFile,WININET.DLL,AW,4 Retrieves a cache entry from the cache in theform of a file.RetrieveUrlCacheEntryStream,WININET.DLL,AW,5 Provides the most efficient andimplementation-independent way of accessing the cache data.ReuseDDElParam,USER32.DLL,NM,5 allows an application to reuse a packed DDE lParamparameter, rather than allocating a new packed lParam.

Page 147: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

147RevertSecurityContext,SECUR32.DLL,NM,1, allows a security package to discontinue theimpersonation of the caller and restore its own security context.RevertToSelf,ADVAPI32.DLL,NM,0, terminates the impersonation of a client application.RevokeActiveObject,OLEAUT32.DLL,NM,2,Ends an object's status as active.RevokeBindStatusCallback,URLMON.DLL,NM,2, Revokes a bind status callback interfacepreviously registered on a bind context.RevokeDragDrop,OLE32.DLL,NM,1,Revokes the registration of the specified applicationwindow as a potential target for OLE drag-and-drop operations.RevokeFormatEnumerator,URLMON.DLL,NM,2, Removes a format enumerator from the givenbind context.RoundRect,GDI32.DLL,NM,7, draws a rectangle with rounded corners.RpcBindingCopy,RPCRT4.DLL,NM,2, copies binding information and creates a new bindinghandle.RpcBindingFree,RPCRT4.DLL,NM,1, releases binding-handle resources.RpcBindingFromStringBinding,RPCRT4.DLL,AW,2, returns a binding handle from a stringrepresentation of a binding handle.RpcBindingInqAuthClient,RPCRT4.DLL,AW,6 A server application calls theRpcBindingInqAuthClient routine to obtain the principal name or privilege attributes of theauthenticated client that made the remote procedure callRpcBindingInqAuthInfo,RPCRT4.DLL,AW,6, returns authentication and authorizationinformation from a binding handle.RpcBindingInqAuthInfoEx,RPCRT4.DLL,AW,8 returns authentication,authorization, and securityquality-of-service information from abinding handle.RpcBindingInqObject,RPCRT4.DLL,NM,2, returns the object UUID from a binding handle.RpcBindingInqOption,RPCRT4.DLL,NM,3 RPC client processes use RpcBindingInqOption todetermine currentvalues of the binding options that are specific to the ncadg_mqmessage-queuing transport.RpcBindingReset,RPCRT4.DLL,NM,1, resets a binding handle so that the host is specified butthe server on that host is unspecified.RpcBindingServerFromClient,RPCRT4.DLL,NM,2, converts a client binding handle to a serverbinding handle.RpcBindingSetAuthInfo,RPCRT4.DLL,AW,6, sets authentication and authorization informationinto a binding handle.RpcBindingSetAuthInfoEx,RPCRT4.DLL,AW,7 sets authentication, authorization, and securityquality-of-service information into a binding handle.RpcBindingSetObject,RPCRT4.DLL,NM,2, sets the object UUID value in a binding handle.RpcBindingSetOption,RPCRT4.DLL,NM,3 enables client applications to specify message-queuing options on a binding handle.RpcBindingToStringBinding,RPCRT4.DLL,AW,2, returns a string representation of a bindinghandle.RpcBindingVectorFree,RPCRT4.DLL,NM,1, frees the binding handles contained in the vectorand the vector itself.RpcCancelThread,RPCRT4.DLL,NM,1, cancels a thread.RpcEpRegister,RPCRT4.DLL,AW,4, adds to or replaces server address information in the localendpoint-map database.RpcEpRegisterNoReplace,RPCRT4.DLL,AW,4, adds server-address information to the localendpoint-map database.RpcEpResolveBinding,RPCRT4.DLL,NM,2, resolves a partially bound server binding handleinto a fully bound server binding handle.RpcEpUnregister,RPCRT4.DLL,NM,3, removes server-address information from the localendpoint-map database.RpcIfIdVectorFree,RPCNS4.DLL,NM,1 frees the vector and the interface-identificationstructures contained in the vector.RpcIfIdVectorFree,RPCRT4.DLL,NM,1 frees the vector and the interface-identificationstructures contained in the vector.RpcIfInqId,RPCRT4.DLL,NM,2, returns the interface-identification part of an interfacespecification.RpcImpersonateClient,RPCRT4.DLL,NM,1 A server thread that is processing client remoteprocedure callscan call the RpcImpersonateClientto impersonate theactive client.RpcMgmtEnableIdleCleanup,RPCRT4.DLL,NM,0 closes idle resources, suchas networkconnections, on the client.RpcMgmtEpEltInqBegin,RPCRT4.DLL,NM,6 RpcMcreates an inquiry context for viewing theelements in an endpoint map.RpcMgmtEpEltInqDone,RPCRT4.DLL,NM,1, deletes the inquiry context for viewing theelements in an endpoint map.RpcMgmtEpEltInqNext,RPCRT4.DLL,AW,5, returns one element from an endpoint map.RpcMgmtEpUnregister,RPCRT4.DLL,NM,4 removes server address informationfrom anendpoint map.RpcMgmtInqComTimeout,RPCRT4.DLL,NM,2, returns the binding- communications timeoutvalue in a binding handle.RpcMgmtInqDefaultProtectLevel,RPCRT4.DLL,NM,2, returns the default authentication level foran authentication service.RpcMgmtInqIfIds,RPCRT4.DLL,NM,2 returns a vector containing the identifiers of the interfacesoffered by the server.RpcMgmtInqServerPrincName,RPCRT4.DLL,AW,3, returns a server?s principal name.RpcMgmtInqStats,RPCRT4.DLL,NM,2 returns RPC run-time statistics.RpcMgmtIsServerListening,RPCRT4.DLL,NM,1, tells whether a server is listening for remoteprocedure calls.RpcMgmtSetAuthorizationFn,RPCRT4.DLL,NM,1 establishes an authorizationfunction forprocessing remote calls to a server?s managementroutines.RpcMgmtSetCancelTimeout,RPCRT4.DLL,NM,1, sets the lower bound on the time to waitbefore timing out after forwarding a cancel.RpcMgmtSetComTimeout,RPCRT4.DLL,NM,2, sets the binding-communications timeout valuein a binding handle.RpcMgmtSetServerStackSize,RPCRT4.DLL,NM,1, specifies the stack size for each serverthread.RpcMgmtStatsVectorFree,RPCRT4.DLL,NM,1, frees a statistics vector.RpcMgmtStopServerListening,RPCRT4.DLL,NM,1, tells a server to stop listening for remoteprocedure calls.RpcNetworkInqProtseqs,RPCRT4.DLL,AW,1 returns all protocol sequencessupported by boththe RPC run-time library and the operatingsystem.RpcNetworkIsProtseqValid,RPCRT4.DLL,AW,1 tells whether the specified protocol sequence issupported by both the RPC run-time library and the operating system.RpcNsBindingExport,RPCNS4.DLL,AW,5 establishes a name-service databaseentry withmultiple binding handles and multiple objects for aserver.RpcNsBindingImportBegin,RPCNS4.DLL,AW,5, creates an import context for an interface andan object.RpcNsBindingImportDone,RPCNS4.DLL,NM,1 signifies that a client hasfinished looking for acompatible server and deletes the importcontext.RpcNsBindingImportNext,RPCNS4.DLL,NM,2 looks up an interface, and optionally an object,from a name-service database and returns a binding handle of a compatible server (if found).RpcNsBindingInqEntryName,RPCRT4.DLL,AW,3, returns the entry name from which thebinding handle came.RpcNsBindingLookupBegin,RPCNS4.DLL,AW,6, creates a lookup context for an interface andan object.RpcNsBindingLookupDone,RPCNS4.DLL,NM,1 signifies that a client hasfinished looking forcompatible servers and deletes the lookupcontext.RpcNsBindingLookupNext,RPCNS4.DLL,NM,2, returns a list of compatible binding handles fora specified interface and optionally an object.

RpcNsBindingSelect,RPCNS4.DLL,NM,2, returns a binding handle from a list of compatiblebinding handles.RpcNsBindingUnexport,RPCNS4.DLL,AW,4 removes the binding handles foran interface andobjects from an entry in the name-servicedatabase.RpcNsEntryExpandName,RPCNS4.DLL,AW,3, expands a name-service entry name.RpcNsEntryObjectInqBegin,RPCNS4.DLL,AW,3, creates an inquiry context for a name-servicedatabase entry?s objects.RpcNsEntryObjectInqDone,RPCNS4.DLL,NM,1, deletes the inquiry context for a name-servicedatabase entry?s objects.RpcNsEntryObjectInqNext,RPCNS4.DLL,NM,2, returns one object at a time from a name-service database entry.RpcNsGroupDelete,RPCNS4.DLL,AW,2 deletes a group attribute.RpcNsGroupMbrAdd,RPCNS4.DLL,AW,4, adds an entry name to a group.RpcNsGroupMbrInqBegin,RPCNS4.DLL,AW,4, creates an inquiry context for viewing groupmembers.RpcNsGroupMbrInqDone,RPCNS4.DLL,NM,1, deletes the inquiry context for a group.RpcNsGroupMbrInqNext,RPCNS4.DLL,AW,2, returns one entry name from a group at a time.RpcNsGroupMbrRemove,RPCNS4.DLL,AW,4, removes an entry name from a group.RpcNsMgmtBindingUnexport,RPCNS4.DLL,AW,5, removes multiple binding handles andobjects from an entry in the name-service database.RpcNsMgmtEntryCreate,RPCNS4.DLL,AW,2, creates a name-service database entry.RpcNsMgmtEntryDelete,RPCNS4.DLL,AW,2, deletes a name-service database entry.RpcNsMgmtEntryInqIfIds,RPCNS4.DLL,AW,3 returns the list of interfaces exported to a name-service database entry.RpcNsMgmtHandleSetExpAge,RPCNS4.DLL,NM,2, sets the expiration age of a name-servicehandle for local copies of name-service data.RpcNsMgmtInqExpAge,RPCNS4.DLL,NM,1 returns the global expiration age for local copies ofname-service data.RpcNsMgmtSetExpAge,RPCNS4.DLL,NM,1, modifies the application?s global expiration agefor local copies of name-service data.RpcNsProfileDelete,RPCNS4.DLL,AW,2, deletes a profile attribute.RpcNsProfileEltAdd,RPCNS4.DLL,AW,7, adds an element to a profile.RpcNsProfileEltInqBegin,RPCNS4.DLL,AW,8 creates an inquiry context for viewing theelements in a profile.RpcNsProfileEltInqDone,RPCNS4.DLL,NM,1, deletes the inquiry context for viewing theelements in a profile.RpcNsProfileEltInqNext,RPCNS4.DLL,AW,5, returns one element at a time from a profile.RpcNsProfileEltRemove,RPCNS4.DLL,AW,5, removes an element from a profile.RpcObjectInqType,RPCRT4.DLL,NM,2, returns the type of an object.RpcObjectSetInqFn,RPCRT4.DLL,NM,1, registers an object-inquiry function.RpcObjectSetType,RPCRT4.DLL,NM,2, assigns the type of an object.RpcProtseqVectorFree,RPCRT4.DLL,AW,1, frees the protocol sequences contained in thevector and the vector itself.RpcRaiseException,RPCRT4.DLL,NM,1 Use the RpcRaiseExceptionto raise an exception.RpcRevertToSelf,RPCRT4.DLL,NM,0 After calling RpcImpersonateClient and completing anytasks thatrequire client impersonation, the server calls RpcRevertToSelf toend impersonationand to reestablish its own security identity.RpcRevertToSelfEx,RPCRT4.DLL,NM,1 After calling RpcImpersonateClient and completingany tasks thatrequire client impersonation, the server calls RpcRevertToSelfEx toendimpersonation and to reestablish its own security identity.RpcServerInqBindings,RPCRT4.DLL,NM,1, returns the binding handles over which remoteprocedure calls can be received.RpcServerInqDefaultPrincName,RPCRT4.DLL,AW,2, obtains the default principal name fromthe server.RpcServerInqIf,RPCRT4.DLL,NM,3, returns the manager entry-point vector (EPV) registeredfor an interface.RpcServerListen,RPCRT4.DLL,NM,3, tells the RPC run-time library to listen for remoteprocedure calls.RpcServerRegisterAuthInfo,RPCRT4.DLL,AW,4, registers authentication information with theRPC run-time library.RpcServerRegisterIf,RPCRT4.DLL,NM,3 registers an interface with the RPC run-time library.RpcServerRegisterIfEx,RPCRT4.DLL,NM,6, registers an interface with the RPC run-timelibrary.RpcServerUnregisterIf,RPCRT4.DLL,NM,3, unregisters an interface from the RPC run-timelibrary.RpcServerUseAllProtseqs,RPCRT4.DLL,NM,2 tells the RPC run-time library to use allsupported protocol sequences for receiving remote procedure calls.RpcServerUseAllProtseqsEx,RPCRT4.DLL,NM,3 tells the RPC run-timelibrary to use allsupported protocol sequences for receivingremote procedure calls.RpcServerUseAllProtseqsIf,RPCRT4.DLL,NM,3 tells the RPC run-time library to use all thespecified protocol sequences and endpoints in the interface specification for receiving remoteprocedure calls.RpcServerUseAllProtseqsIfEx,RPCRT4.DLL,NM,4 tells the RPC run-time library to use all thespecified protocol sequences and endpoints in the interface specification for receiving remoteprocedure calls.RpcServerUseProtseq,RPCRT4.DLL,AW,3 tells the RPC run-time library to use the specifiedprotocol sequence for receiving remote procedure calls.RpcServerUseProtseqEp,RPCRT4.DLL,AW,4 tells the RPC run-time library to use the specifiedprotocol sequence combined with the specified endpoint for receiving remote procedure calls. .RpcServerUseProtseqEpEx,RPCRT4.DLL,AW,5 tells the RPC run-time libraryto use thespecified protocol sequence combined with the specifiedendpoint for receiving remoteprocedure calls.RpcServerUseProtseqEx,RPCRT4.DLL,AW,4 tells the RPC run-time libraryto use the specifiedprotocol sequence for receiving remoteprocedure calls.RpcServerUseProtseqIf,RPCRT4.DLL,AW,4 tells the RPC run-time library to use the specifiedprotocol sequence combined with the endpoints in the interface specification for receivingremote procedure calls.RpcServerUseProtseqIfEx,RPCRT4.DLL,AW,5 tells the RPC run-time library to use thespecified protocol sequence combined with the endpoints in the interface specification forreceiving remote procedure calls.RpcSmAllocate,RPCRT4.DLL,NM,2 allocates memory within the RPC stub memorymanagement function and returns a pointer to the allocated memory or NULL.RpcSmClientFree,RPCRT4.DLL,NM,1, frees memory returned from a client stub.RpcSmDestroyClientContext,RPCRT4.DLL,NM,1, reclaims the client memory resources for acontext handle and makes the context handle NULL.RpcSmDisableAllocate,RPCRT4.DLL,NM,0, frees resources and memory within the stubmemory management environment.RpcSmEnableAllocate,RPCRT4.DLL,NM,0, establishes the stub memory managementenvironment.RpcSmFree,RPCRT4.DLL,NM,1, releases memory allocated by RpcSmAllocate.RpcSmGetThreadHandle,RPCRT4.DLL,NM,1, returns a thread handle, or NULL, for the stubmemory management environment.RpcSmSetClientAllocFree,RPCRT4.DLL,NM,2, enables the memory allocation and releasemechanisms used by the client stubs.RpcSmSetThreadHandle,RPCRT4.DLL,NM,1, sets a thread handle for the stub memorymanagement environment.RpcSmSwapClientAllocFree,RPCRT4.DLL,NM,4 exchanges the memoryallocation and releasemechanisms used by the client stubs with onesupplied by the client.

Page 148: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

148RpcSsAllocate,RPCRT4.DLL,NM,1 allocates memory within the RPC stubmemorymanagement function, and returns a pointer to the allocatedmemory or NULL.RpcSsDestroyClientContext,RPCRT4.DLL,NM,1, destroys a context handle no longer neededby the client without contacting the server.RpcSsDisableAllocate,RPCRT4.DLL,NM,0, frees resources and memory within the stubmemory management environment.RpcSsDontSerializeContext,RPCRT4.DLL,NM,0, disables runtime serialization of multiple callsdispatched to server manager routines on the same context handle.RpcSsEnableAllocate,RPCRT4.DLL,NM,0 establishes the stub memory managementenvironment..RpcSsFree,RPCRT4.DLL,NM,1, releases memory allocated by RpcSsAllocate.RpcSsGetThreadHandle,RPCRT4.DLL,NM,0, returns a thread handle for the stub memorymanagement environment.RpcSsSetClientAllocFree,RPCRT4.DLL,NM,2, enables the memory allocation and releasemechanisms used by the client stubs.RpcSsSetThreadHandle,RPCRT4.DLL,NM,1, sets a thread handle for the stub memorymanagement environment.RpcSsSwapClientAllocFree,RPCRT4.DLL,NM,4 exchanges the memoryallocation and releasemechanisms used by the client stubs with onesupplied by the client.RpcStringBindingCompose,RPCRT4.DLL,AW,6 combines the components of a string bindinginto a string binding.RpcStringBindingParse,RPCRT4.DLL,AW,6, returns the object UUID part and the addressparts of a string binding as separate strings.RpcStringFree,RPCRT4.DLL,AW,1 frees a character string allocated by the RPC run-timelibrary.RpcTestCancel,RPCRT4.DLL,NM,0, checks for a cancel indication.RTFSync,MAPI32.DLL,NM,3, ensures that the Rich Text Format (RTF) message text matchesthe plain text version.SafeArrayAccessData,OLEAUT32.DLL,NM,2,Increments the lock count of an array, andretrieves a pointer to the array data.SafeArrayAllocData,OLEAUT32.DLL,NM,1,This function allocates memory for a safearray,based on a descriptor created with SafeArrayAllocDescriptor.SafeArrayAllocDescriptor,OLEAUT32.DLL,NM,2,Allocates memory for a safearray descriptor.SafeArrayCopy,OLEAUT32.DLL,NM,2,Data4.2 SafeArrayCopyData This function copies thesource array to the target array after releasing any resources in the target array. This function isSafeArrayCopyData,OLEAUT32.DLL,NM,2,4.2 This function copies the source array to thetarget array after releasing any resources in the target array.SafeArrayCreate,OLEAUT32.DLL,NM,3,VectorCreates a one-dimensional array whose lowerbound is always zero. A safearray created with SafeArrayCreateVector is a fixed size, so theconstant FADF_FIXEDSIZE is always set.SafeArrayCreateVector,OLEAUT32.DLL,NM,3,Creates a one-dimensional array whose lowerbound is always zero. A safearray created with SafeArrayCreateVector is a fixed size, so theconstant FADF_FIXEDSIZE is always set.SafeArrayDestroy,OLEAUT32.DLL,NM,1,Descriptor This function destroys a decriptor of a safearray.SafeArrayDestroyData,OLEAUT32.DLL,NM,1,This function destroys all the data in a safearray.SafeArrayDestroyDescriptor,OLEAUT32.DLL,NM,1, This function destroys a decriptor of a safearray.SafeArrayGetDim,OLEAUT32.DLL,NM,1,Returns the number of dimensions in the array.SafeArrayGetElement,OLEAUT32.DLL,NM,3,Retrieves a single element of the array.SafeArrayGetElemsize,OLEAUT32.DLL,NM,1, retrieves the size (in bytes) of the elements of asafearray.SafeArrayGetLBound,OLEAUT32.DLL,NM,3,4.2 returns the lower bound for any dimension of asafearray.SafeArrayGetUBound,OLEAUT32.DLL,NM,3,Returns the upper bound for any dimension of asafearray.SafeArrayLock,OLEAUT32.DLL,NM,1,This function increments the lock count of an array, andplaces a pointer to the array data in pvData of the array descriptor.SafeArrayPtrOfIndex,OLEAUT32.DLL,NM,3,Returns a pointer to an array element.SafeArrayPutElement,OLEAUT32.DLL,NM,3,Stores the data element at a given location in thearray.SafeArrayRedim,OLEAUT32.DLL,NM,2,Changes the right-most (least significant) bound of asafearray.SafeArrayUnaccessData,OLEAUT32.DLL,NM,1,Decrements the lock count of an array, andinvalidates the pointer retrieved by SafeArrayAccessData.SafeArrayUnlock,OLEAUT32.DLL,NM,1,Decrements the lock count of an array so it can befreed or resized.SaslAcceptSecurityContext,SECUR32.DLL,NM,9,Wraps a standard call to the Security SupportProvider InterfaceB AcceptSecurityContext (General) function and includes creation of SASLserver cookies.SaslEnumerateProfiles,SECUR32.DLL,AW,2,Lists the packages that provide a SASL interface.SaslGetProfilePackage,SECUR32.DLL,AW,2,Returns the package information for the specifiedpackage.SaslIdentifyPackage,SECUR32.DLL,AW,2,Returns the negotiate prefix that matches thespecified SASL negotiation buffer.SaslInitializeSecurityContext,SECUR32.DLL,AW,12,Wraps a standard call to the SecuritySupport Provider InterfaceB InitializeSecurityContext (General) function and processes SASLserver cookies from the server.SatisfyNtmsOperatorRequest,NTMSAPI.DLL,NM,2, completes the specified RSM operatorrequest.SaveDC,GDI32.DLL,NM,1 saves the current state of the specified device context (DC) bycopying data describing selected objects and graphic modes (such as the bitmap, brush,palette, font, pen, region, drawing mode, and mapping mode) to a context stack.ScaleViewportExtEx,GDI32.DLL,NM,6 modifies the viewport for a devicecontext (DC) by usingthe ratios formed by the specifiedmultiplicands and divisors.ScaleWindowExtEx,GDI32.DLL,NM,6 modifies the window for a devicecontext using the ratiosformed by the specified multiplicands anddivisors.ScBinFromHexBounded,MAPI32.DLL,NM,3 converts the specified portion of a stringrepresentation of a hexadecimal number into a binary number.ScCopyNotifications,MAPI32.DLL,NM,4, copies a group of event notifications to a single blockof memory.ScCopyProps,MAPI32.DLL,NM,4, copies the properties defined by an array of SPropValuestructures to a new destination.ScCountNotifications,MAPI32.DLL,NM,3 determines the size, in bytes, ofan array of eventnotifications, and validates the memoryassociated with the array.ScCountProps,MAPI32.DLL,NM,3 determines the size, in bytes, of aproperty value array andvalidates the memory associated with thearray.ScCreateConversationIndex,MAPI32.DLL,NM,4, indicates where in a message thread amessage belongs.ScDupPropset,MAPI32.DLL,NM,4 duplicates a property value array in a single block of MAPImemory combining the operations of the ScCopyProps </native/mapi/src/func2mpf.htm> andScCountProps functions.ScheduleJob,WINMM.DLL,NM,2, checks for a valid spool file.SchemaPreload,DAPI.DLL,AW,2, is an example of a process terminated by DAPIUninitialize.ScInitMapiUtil,MAPI32.DLL,NM,1, replaces MAPIInitialize when only select utility functions arebeing used.ScLocalPathFromUNC,MAPI32.DLL,NM,3, locates a local path counterpart to the givenuniversal naming convention (UNC) path.

ScreenToClient,USER32.DLL,NM,2, converts the screen coordinates of a specified point on thescreen to client coordinates.ScRelocNotifications,MAPI32.DLL,NM,5, adjusts a pointer within a specified event notificationarray.ScRelocProps,MAPI32.DLL,NM,5 adjusts the pointers in an SPropValue array after the arrayand its data have been copied or moved to a new location.ScrollConsoleScreenBuffer,KERNEL32.DLL,AW,5, moves a block of data in a screen buffer.ScrollDC,USER32.DLL,NM,7, scrolls a rectangle of bits horizontally and vertically.ScrollWindow,USER32.DLL,NM,5, scrolls the content of the specified window?s client area.ScrollWindowEx,USER32.DLL,NM,8, scrolls the content of the specified window?s client area.ScUNCFromLocalPath,MAPI32.DLL,NM,3, locates a universal naming convention (UNC) pathcounterpart to the given local path.SealMessage,SECUR32.DLL,NM,4, is already documented under another name. For moreinformation, see SpSealMessage.SearchPath,KERNEL32.DLL,AW,6, searches for the specified file.SearchTreeForFile,IMAGEHLP.DLL,NM,3, searches a directory tree for a specified file.select,WS2_32.DLL,NM,5, is used to determine the status of one or more sockets.select,WSOCK32.DLL,NM,5, is used to determine the status of one or more sockets.SelectClipPath,GDI32.DLL,NM,2, selects the current path as a clipping region for a devicecontext, combining the new region with any existing clipping region by using the specifiedmode. .SelectClipRgn,GDI32.DLL,NM,2, selects a region as the current clipping region for the specifieddevice context.SelectCMM,MSCMS.DLL,NM,1,SelectCMM allows an application to select the preferred colormanagement module (CMM) to use.SelectObject,GDI32.DLL,NM,2 selects an object into the specified device context.SelectPalette,GDI32.DLL,NM,3, selects the specified logical palette into a device context.send,WS2_32.DLL,NM,4, is used to write outgoing data on a connected socket.send,WSOCK32.DLL,NM,4, is used to write outgoing data on a connected socket.SendDlgItemMessage,USER32.DLL,AW,5, sends a message to the specified control in a dialogbox.SendInput,USER32.DLL,NM,3, synthesizes keystrokes, mouse motions, and button clicks.SendMessage,USER32.DLL,AW,4 sends the specified message to a window or windows.SendMessageCallback,USER32.DLL,AW,6, sends the specified message to a window orwindows.SendMessageTimeout,USER32.DLL,AW,7, sends the specified message to a window orwindows.SendNotifyMessage,USER32.DLL,AW,4, sends the specified message to a window.sendto,WS2_32.DLL,NM,6, is used to write outgoing data on a socket.sendto,WSOCK32.DLL,NM,6, is used to write outgoing data on a socket.SetAbortProc,GDI32.DLL,NM,2, sets the application-defined abort function that allows a printjob to be canceled during spooling.SetAclInformation,ADVAPI32.DLL,NM,4, sets information about an access- control list (ACL).SetActiveWindow,USER32.DLL,NM,1, activates a window, but not if the application is in thebackground.SetArcDirection,GDI32.DLL,NM,2 sets the drawing direction to be used for arc and rectanglefunctions.SetAttribIMsgOnIStg,MAPI32.DLL,NM,4 sets or alters attributes ofproperties on an IMessageobject supplied by the OpenIMsgOnIStgfunction.SetBitmapBits,GDI32.DLL,NM,3, sets the bits of color data for a bitmap to the specified values.SetBitmapDimensionEx,GDI32.DLL,NM,4, assigns preferred dimensions to a bitmap.SetBkColor,GDI32.DLL,NM,2 sets the current background color to thespecified color value, orto the nearest physical color if thedevice cannot represent the specified color value.SetBkMode,GDI32.DLL,NM,2, sets the background mix mode of the specified device context.SetBoundsRect,GDI32.DLL,NM,3 controls the accumulation of bounding rectangle informationfor the specified device context.SetBrushOrgEx,GDI32.DLL,NM,4 sets the brush origin that GDI assigns to the next brush anapplication selects into the specified device context.SetCapture,USER32.DLL,NM,1, sets the mouse capture to the specified window belonging tothe current thread.SetCaretBlinkTime,USER32.DLL,NM,1, sets the caret blink time to the specified number ofmilliseconds.SetCaretPos,USER32.DLL,NM,2 moves the caret to the specified coordinates.SetClassLong,USER32.DLL,AW,3 replaces the specified 32-bit (long) value at the specifiedoffset into the extra class memory or the WNDCLASSEX structure for the class to which thespecified window belongs.SetClassWord,USER32.DLL,NM,3 replaces the 16-bit (word) value at thespecified offset intothe extra class memory for the window classto which the specified window belongs.SetClipboardData,USER32.DLL,NM,2, places data on the clipboard in a specified clipboardformat.SetColorAdjustment,GDI32.DLL,NM,2, sets the color adjustment values for a device contextusing the specified values.SetColorProfileElement,MSCMS.DLL,NM,5, sets the element data for a tagged profile element.SetColorProfileElementReference,MSCMS.DLL,NM,3,SetColorProfileElementReferencecreates in a specified color profile a new tag which references the same data as an existing tag.SetColorProfileElementSize,MSCMS.DLL,NM,3,SetColorProfileElementSize sets the size of atagged element.SetColorProfileHeader,MSCMS.DLL,NM,2, sets the header data in a specified color profile.SetCommBreak,KERNEL32.DLL,NM,1 suspends character transmission for aspecifiedcommunications device and places the transmission line ina break state until theClearCommBreak function is called.SetCommConfig,KERNEL32.DLL,NM,3, sets the current configuration of a communicationsdevice.SetCommMask,KERNEL32.DLL,NM,2, specifies a set of events to be monitored for acommunications device.SetCommState,KERNEL32.DLL,NM,2 configures a communications device according to thespecifications in a device-control blockSetCommTimeouts,KERNEL32.DLL,NM,2 sets the time-out parameters for all read and writeoperations on a specified communications device.SetComputerName,KERNEL32.DLL,AW,1, sets the computer name to be used the next timethe system is restarted.SetConsoleActiveScreenBuffer,KERNEL32.DLL,NM,1, sets the specified screen buffer to bethe currently displayed console screen buffer.SetConsoleCP,KERNEL32.DLL,NM,1, sets the input code page used by the consoleassociated with the calling process.SetConsoleCtrlHandler,KERNEL32.DLL,NM,2 adds or removes an application-definedHandlerRoutine function from the list of handler functions for the calling process.SetConsoleCursorInfo,KERNEL32.DLL,NM,2, sets the size and visibility of the cursor for thespecified console screen buffer.SetConsoleCursorPosition,KERNEL32.DLL,NM,2, sets the cursor position in the specifiedconsole screen buffer.SetConsoleMode,KERNEL32.DLL,NM,2 sets the input mode of a console?sinput buffer or theoutput mode of a console screen buffer.SetConsoleOutputCP,KERNEL32.DLL,NM,1, sets the output code page used by the consoleassociated with the calling process.SetConsoleScreenBufferSize,KERNEL32.DLL,NM,2, changes the size of the specified consolescreen buffer.

Page 149: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

149SetConsoleTextAttribute,KERNEL32.DLL,NM,2 sets the foreground (text) and background colorattributes of characters written to the screen buffer by the WriteFile or WriteConsole function,or echoed by the ReadFile or ReadConsole function.SetConsoleTitle,KERNEL32.DLL,AW,1, sets the title bar string for the current console window.SetConsoleWindowInfo,KERNEL32.DLL,NM,3 sets the current size and position of a consolescreen buffer?s window.SetConvertStg,OLE32.DLL,NM,2, sets the convert bit in a storage object to indicate that theobject is to be converted to a new class when it is opened. The setting can be retrieved with acall to the GetConvertStg function.SetCurrentDirectory,KERNEL32.DLL,AW,1 changes the current directory for the currentprocess.SetCursor,USER32.DLL,NM,1, establishes the cursor shape.SetCursorPos,USER32.DLL,NM,2, moves the cursor to the specified screen coordinates.SetDebugErrorLevel,USER32.DLL,NM,1 sets the minimum error level atwhich Windows willgenerate debugging events and pass them to adebugger.SetDefaultCommConfig,KERNEL32.DLL,AW,3, sets the default configuration for acommunications device.SetDIBColorTable,GDI32.DLL,NM,4 sets RGB (red, green, blue) color values in a range ofentries in the color table of the device-independent bitmap (DIB) that is currently selected into aspecified device context.SetDIBits,GDI32.DLL,NM,7, sets the pixels in a bitmap using the color data found in thespecified device-independent bitmap (DIB).SetDIBitsToDevice,GDI32.DLL,NM,12 sets the pixels in the specified rectangle on the devicethat is associated with the destination device context using color data from a device-independent bitmap (DIB).SetDlgItemInt,USER32.DLL,NM,4, sets the text of a control in a dialog box to the stringrepresentation of a specified integer value.SetDlgItemText,USER32.DLL,AW,3, sets the title or text of a control in a dialog box.SetDoubleClickTime,USER32.DLL,NM,1, sets the double-click time for the mouse.SetEndOfFile,KERNEL32.DLL,NM,1 Sets End-of-file (EOF) position for the specified file to thecurrent position of the file pointer.SetEnhMetaFileBits,GDI32.DLL,NM,2, creates a memory-based enhanced- format metafilefrom the supplied data.SetEntriesInAcl,ADVAPI32.DLL,AW,4 creates a new access-control list(ACL) by merging newaccess-control or audit-control informationinto an existing ACL.SetEnvironmentVariable,KERNEL32.DLL,AW,2, sets the value of an environment variable forthe current process.SetErrorInfo,OLEAUT32.DLL,NM,2, (Visual C++ Concepts)Called by OnWizFinish andCanUseFileName to provide current error information.SetErrorMode,KERNEL32.DLL,NM,1, controls how the operating system handles several typesof serious errors.SetEvent,KERNEL32.DLL,NM,1 sets the state of the specified event object to signaled.SetFileApisToOEM,KERNEL32.DLL,NM,0, causes a set of Win32 file functions to use the OEMcode page.SetFileAttributes,KERNEL32.DLL,AW,2, sets a file?s attributes.SetFilePointer,KERNEL32.DLL,NM,4, moves the file pointer of an open file.SetFileSecurity,ADVAPI32.DLL,AW,3 sets the security of a file or directory object.SetFileTime,KERNEL32.DLL,NM,4, sets the date and time that a file was created, lastaccessed, or last modified.SetFocus,USER32.DLL,NM,1 sets the keyboard focus to the specified window.SetForegroundWindow,USER32.DLL,NM,1, puts the thread that created the specified windowinto the foreground and activates the window.SetForm,WINMM.DLL,AW,5, sets the form information for the specified printer.SetGraphicsMode,GDI32.DLL,NM,2 sets the graphics mode for the specified device context.SetHandleCount,KERNEL32.DLL,NM,1, sets the number of file handles available to a process.SetHandleInformation,KERNEL32.DLL,NM,3 sets certain properties of an object handle.SetImageConfigInformation,IMAGEHLP.DLL,NM,2, locates and changes the load configurationdata of an image.SetJob,WINMM.DLL,AW,5, pauses, resumes, cancels, or restarts a print job on a specifiedprinter.SetKernelObjectSecurity,ADVAPI32.DLL,NM,3 sets the security of a kernel object.SetKeyboardState,USER32.DLL,NM,1, copies a 256-byte array of keyboard key states into thecalling thread?s keyboard-input state table.SetLastError,KERNEL32.DLL,NM,1, sets the last-error code for the calling thread.SetLastErrorEx,USER32.DLL,NM,2, sets the last-error code.SetLocaleInfo,KERNEL32.DLL,AW,3, sets an item of locale information.SetLocalTime,KERNEL32.DLL,NM,1, sets the current local time and date.SetMailslotInfo,KERNEL32.DLL,NM,2, sets the time-out value used by the specified mailslot fora read operation.SetMapMode,GDI32.DLL,NM,2, sets the mapping mode of the specified device context.SetMapperFlags,GDI32.DLL,NM,2, alters the algorithm the font mapper uses when it mapslogical fonts to physical fonts.SetMenu,USER32.DLL,NM,2, assigns a new menu to the specified window.SetMenuContextHelpId,USER32.DLL,NM,2, associates a help context identifier with a menu.SetMenuDefaultItem,USER32.DLL,NM,3, sets the default menu item for the specified menu.SetMenuItemBitmaps,USER32.DLL,NM,5 associates the specified bitmap with a menu item.SetMenuItemInfo,USER32.DLL,AW,4 changes information about a menu item.SetMessageExtraInfo,USER32.DLL,NM,1, sets the extra message information for the currentthread.SetMessageQueue,USER32.DLL,NM,1, is obsolete.SetMetaFileBitsEx,GDI32.DLL,NM,2, creates a memory-based Windows- format metafile fromthe supplied data.SetMetaRgn,GDI32.DLL,NM,1 intersects the current clipping region for the specified devicecontext with the current metaregion and saves the combined region as the new metaregion forthe specified device context.SetMiterLimit,GDI32.DLL,NM,3, sets the limit for the length of miter joins for the specifieddevice context.SetNamedPipeHandleState,KERNEL32.DLL,NM,4, sets the read mode and the blocking modeof the specified named pipe.SetNamedSecurityInfo,ADVAPI32.DLL,AW,7 sets specified security information in the securitydescriptor of a specified object.SetNtmsMediaComplete,NTMSAPI.DLL,NM,2, marks a piece of logical media as complete.SetNtmsObjectAttribute,NTMSAPI.DLL,AW,6, creates an extended attribute (named privatedata) in the specified RSM object.SetNtmsObjectInformation,NTMSAPI.DLL,AW,3, changes the information structure of thespecified object.SetNtmsObjectSecurity,NTMSAPI.DLL,NM,5, writes the security descriptor for the specifiedRSM object.SetNtmsRequestOrder,NTMSAPI.DLL,NM,3, sets the order that the specified request will beprocessed in the library queue.SetPaletteEntries,GDI32.DLL,NM,4, sets RGB (red, green, blue) color values and flags in arange of entries in a logical palette.SetParent,USER32.DLL,NM,2 changes the parent window of the specified child window.SetPixel,GDI32.DLL,NM,4, sets the pixel at the specified coordinates to the specified color.SetPixelFormat,GDI32.DLL,NM,3 sets the pixel format of the specified device context to theformat specified by the iPixelFormat index.SetPixelV,GDI32.DLL,NM,4, sets the pixel at the specified coordinates to the closestapproximation of the specified color.SetPolyFillMode,GDI32.DLL,NM,2, sets the polygon fill mode for functions that fill polygons.

SetPrinter,WINMM.DLL,AW,4, sets the state of the specified printer by pausing printing,resuming printing, or clearing all print jobs.SetPrinterData,WINMM.DLL,AW,5, sets the configuration data for a printer.SetPriorityClass,KERNEL32.DLL,NM,2, sets the priority class for the specified process.SetPrivateObjectSecurity,ADVAPI32.DLL,NM,5, modifies a private object?s security descriptor.SetProcessAffinityMask,KERNEL32.DLL,NM,2 sets a processor affinity mask for the threads ofa specified process.SetProcessPriorityBoost,KERNEL32.DLL,NM,2 disables the ability of Windows NT totemporarily boost the priority of the threads of the specified process.SetProcessShutdownParameters,KERNEL32.DLL,NM,2, sets shutdown parameters for thecurrently calling process.SetProcessWindowStation,USER32.DLL,NM,1, assigns a window station to the calling process.SetProcessWorkingSetSize,KERNEL32.DLL,NM,3, sets the minimum and maximum workingset sizes for a specified process.SetProp,USER32.DLL,AW,3 adds a new entry or changes an existing entry in the property listof the specified window.SetRect,USER32.DLL,NM,5, sets the coordinates of the specified rectangle.SetRectEmpty,USER32.DLL,NM,1 creates an empty rectangle in which all coordinates are setto zero.SetRectRgn,GDI32.DLL,NM,5, changes a region into a rectangular region with the specifiedcoordinates.SetROP2,GDI32.DLL,NM,2, sets the current foreground mix mode.SetScrollInfo,USER32.DLL,NM,4 sets the parameters of a scroll bar,including the minimum andmaximum scrolling positions, the pagesize, and the position of the scroll box (thumb).SetScrollPos,USER32.DLL,NM,4 sets the position of the scroll box(thumb) in the specifiedscroll bar and, if requested, redraws thescroll bar to reflect the new position of the scroll box.SetScrollRange,USER32.DLL,NM,5, sets the minimum and maximum position values for thespecified scroll bar.SetSecurityDescriptorDacl,ADVAPI32.DLL,NM,4, sets information in a discretionary access-control list (ACL).SetSecurityDescriptorGroup,ADVAPI32.DLL,NM,3 sets the primary group information of anabsolute-format security descriptor, replacing any primary group information already present inthe security descriptor.SetSecurityDescriptorOwner,ADVAPI32.DLL,NM,3, sets the owner information of an absolute-format security descriptor.SetSecurityDescriptorSacl,ADVAPI32.DLL,NM,4, sets information in a system access-controllist (ACL).SetSecurityInfo,ADVAPI32.DLL,NM,7, sets specified security information in the securitydescriptor of a specified object.SetService,MSWSOCK.DLL,AW,6,Important is obsolete.SetService,WSOCK32.DLL,AW,6,Important is obsolete.SetServiceBits,ADVAPI32.DLL,NM,4 registers a service type with the service control managerand the Server service.SetServiceObjectSecurity,ADVAPI32.DLL,NM,3, sets the security descriptor of a service object.SetServiceStatus,ADVAPI32.DLL,NM,2, updates the service control manager?s statusinformation for the calling service.setsockopt,WS2_32.DLL,NM,5, sets a socket option.setsockopt,WSOCK32.DLL,NM,5, sets a socket option.SetStandardColorSpaceProfile,MSCMS.DLL,AW,3, registers a specified profile for a givenstandard color space.SetStdHandle,KERNEL32.DLL,NM,2, is used to set the handle for the standard input, standardoutput, or standard error device.SetStretchBltMode,GDI32.DLL,NM,2, sets the bitmap stretching mode in the specified devicecontext.SetSysColors,USER32.DLL,NM,3, sets the colors for one or more display elements.SetSystemCursor,USER32.DLL,NM,2 replaces the contents of the system cursor specified byid with the contents of the cursor specified by hcur, and then destroys hcur.SetSystemPaletteUse,GDI32.DLL,NM,2, allows an application to specify whether the systempalette contains 2 or 20 static colors.SetSystemPowerState,KERNEL32.DLL,NM,2, suspends the system by shutting power down.SetSystemTime,KERNEL32.DLL,NM,1, sets the current system time and date.SetTapeParameters,KERNEL32.DLL,NM,3, either specifies the block size of a tape orconfigures the tape device.SetTapePosition,KERNEL32.DLL,NM,6 sets the tape position on the specified device.SetTextAlign,GDI32.DLL,NM,2, sets the text-alignment flags for the specified device context.SetTextCharacterExtra,GDI32.DLL,NM,2 sets the intercharacter spacing.SetTextColor,GDI32.DLL,NM,2, sets the text color for the specified device context to thespecified color.SetTextJustification,GDI32.DLL,NM,3, specifies the amount of space Windows should add tothe break characters in a string of text.SetThreadAffinityMask,KERNEL32.DLL,NM,2, sets a processor affinity mask for a specifiedthread.SetThreadContext,KERNEL32.DLL,NM,2, sets the context in the specified thread.SetThreadDesktop,USER32.DLL,NM,1, assigns a desktop to the calling thread.SetThreadIdealProcessor,KERNEL32.DLL,NM,2, is used to specify a preferred processor for athread.SetThreadLocale,KERNEL32.DLL,NM,1, sets the calling thread?s current locale.SetThreadPriority,KERNEL32.DLL,NM,2, sets the priority value for the specified thread.SetThreadPriorityBoost,KERNEL32.DLL,NM,2, disables the ability of Windows NT totemporarily boost the priority of a thread.SetThreadToken,ADVAPI32.DLL,NM,2, assigns an impersonation token to a thread.SetTimer,USER32.DLL,NM,4, creates a timer with the specified time-out value.SetTimeZoneInformation,KERNEL32.DLL,NM,1 sets the current time-zone parameters.SetTokenInformation,ADVAPI32.DLL,NM,4, sets various types of information for a specifiedaccess token.SetUnhandledExceptionFilter,KERNEL32.DLL,NM,1 lets an applicationsupersede the top-levelexception handler that Win32 places at thetop of each thread and process.SetupColorMatching,ICMUI.DLL,AW,1,creates a Color Management dialog box that lets theuser choose whether to enable color management, and if so, provides control over the colorprofiles used and over the rendering intent.SetupComm,KERNEL32.DLL,NM,3, initializes the communications parameters for a specifiedcommunications device.SetUrlCacheConfigInfo,WININET.DLL,AW,2,4.2 sets cache configuration information.BOOLAPI SetUrlCacheConfigInfoA( LPINTERNET_CACHE_CONFIG_INFOASetUrlCacheEntryGroup,WININET.DLL,AW,7,Adds entries to or removes entries from a cachegroup.SetUrlCacheEntryInfo,WININET.DLL,AW,3,Sets the specified members of theINTERNET_CACHE_ENTRY_INFO structure.SetUrlCacheGroupAttribute,WININET.DLL,AW,6,Sets the attribute information of the specifiedcache group.SetUserObjectInformation,USER32.DLL,AW,4, sets information about a window station ordesktop object.SetUserObjectSecurity,USER32.DLL,NM,3, sets the security of a user object.SetViewportExtEx,GDI32.DLL,NM,4 sets the horizontal and vertical extents of the viewport for adevice context by using the specified values.SetViewportOrgEx,GDI32.DLL,NM,4, sets the viewport origin of a device context by using thespecified coordinates.SetVolumeLabel,KERNEL32.DLL,AW,2, sets the label of a file system volume.SetWaitableTimer,KERNEL32.DLL,NM,6, activates the specified ?waitable? timer.

Page 150: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

150SetWindowContextHelpId,USER32.DLL,NM,2, associates a help context identifier with thespecified window.SetWindowExtEx,GDI32.DLL,NM,4 sets the horizontal and vertical extents of the window for adevice context by using the specified values.SetWindowLong,USER32.DLL,AW,3 changes an attribute of the specifiedwindow.SetWindowOrgEx,GDI32.DLL,NM,4, sets the window origin of the device context by using thespecified coordinates.SetWindowPlacement,USER32.DLL,NM,2 sets the show state and therestored, minimized, andmaximized positions of the specifiedwindow.SetWindowPos,USER32.DLL,NM,7 changes the size, position, and Z order of a child, pop-up,or top-level window.SetWindowRgn,USER32.DLL,NM,3, sets the window region of a window.SetWindowsHook,USER32.DLL,AW,2 is obsolete.SetWindowsHookEx,USER32.DLL,AW,4, installs an application-defined hook procedure into ahook chain.SetWindowText,USER32.DLL,AW,2, changes the text of the specified window?s title bar (if ithas one).SetWindowWord,USER32.DLL,NM,3, is obsolete.SetWinMetaFileBits,GDI32.DLL,NM,4 converts a metafile from the older Windows format to thenew enhanced format and stores the new metafile in memory.SetWorldTransform,GDI32.DLL,NM,2 sets a two-dimensional linear transformation betweenworld space and page space for the specified device context.SHAddToRecentDocs,SHELL32.DLL,NM,2 _hreadAdds a document to the shell?s list ofrecently used documents orclears all documents from the list.SHAppBarMessage,SHELL32.DLL,NM,2 Sends an appbar message to the system.SHBrowseForFolder,SHELL32.DLL,AW,1 Displays a dialog box that enables the user to selecta shellfolder.SHChangeNotify,SHELL32.DLL,NM,4 Notifies the system of an event that an application hasperformed.ShellAbout,SHELL32.DLL,AW,4, displays a Shell About dialog box.ShellExecute,SHELL32.DLL,AW,6, opens or prints a specified file.ShellExecuteEx,SHELL32.DLL,AW,1, performs an action on a file.Shell_NotifyIcon,SHELL32.DLL,AW,2 Sends a message to the system to add, modify, or deletean iconfrom the taskbar status area.SHFileOperation,SHELL32.DLL,AW,1 Performs a copy, move, rename, or delete operation ona file systemobject.SHFree,SHELL32.DLL,NM,1 Frees the memory allocated by SHAlloc.SHFreeNameMappings,SHELL32.DLL,NM,1 Frees a file name mapping object that wasretrieved by the SHFileOperation function.SHGetDataFromIDList,SHELL32.DLL,AW,5 retrieves extended property datafrom a relativeIDList.SHGetDesktopFolder,SHELL32.DLL,NM,1 Retrieves the IShellFolder interface for the desktopfolder, whichis the root of the shell?s name space.SHGetFileInfo,SHELL32.DLL,AW,5 Retrieves information about an object in the file system,such as afile, a folder, a directory, or a drive root.SHGetInstanceExplorer,SHELL32.DLL,NM,1 Retreives the address of the Explorer?sIUnknown interface.SHGetMalloc,SHELL32.DLL,NM,1 Retrieves a pointer to the shell?s IMalloc interface.SHGetPathFromIDList,SHELL32.DLL,AW,2 Converts an item identifier list to a file system path.SHGetSpecialFolderLocation,SHELL32.DLL,NM,3 Retrieves the location of a special folder.SHLoadInProc,SHELL32.DLL,NM,1 Creates an instance of the specified object class fromwithin thecontext of the shell?s process.ShowCaret,USER32.DLL,NM,1, makes the caret visible on the screen at the caret?s currentposition.ShowCursor,USER32.DLL,NM,1, displays or hides the cursor.ShowHideMenuCtl,COMCTL32.DLL,NM,3 sets or removes the specified menuitem?s check-mark attribute, and shows or hides the correspondingcontrol.ShowOwnedPopups,USER32.DLL,NM,2, shows or hides all pop-up windows owned by thespecified window.ShowScrollBar,USER32.DLL,NM,3 shows or hides the specified scroll bar.ShowWindow,USER32.DLL,NM,2, sets the specified window?s show state.ShowWindowAsync,USER32.DLL,NM,2, sets the show state of a window created by a differentthread.shutdown,WS2_32.DLL,NM,2, is used on all types of sockets to disable reception,transmission, or both.shutdown,WSOCK32.DLL,NM,2, is used on all types of sockets to disable reception,transmission, or both.SignalObjectAndWait,KERNEL32.DLL,NM,4, allows the caller to atomically signal an object andwait on another object.SizeofResource,KERNEL32.DLL,NM,2, returns the size, in bytes, of the specified resource.Sleep,KERNEL32.DLL,NM,1, suspends the execution of the current thread for a specifiedinterval.SleepEx,KERNEL32.DLL,NM,2 causes the current thread to enter a wait state An I/Ocompletion callback function is called, An asynchronous procedure call (APC) is queued to thethread., The time-out interval elapsessndPlaySound,WINMM.DLL,AW,2, plays a waveform sound specified either by a filename or byan entry in the registry or the WIN.SnmpMgrClose,MGMTAPI.DLL,NM,1, closes communications sockets and data structuresassociated with the specified session.SnmpMgrCtl,MGMTAPI.DLL,NM,7,sets an operating parameter associated with an SNMPsession.SnmpMgrGetTrap,MGMTAPI.DLL,NM,6, returns outstanding trap data that the caller has notreceived if trap reception is enabled.SnmpMgrGetTrapEx,MGMTAPI.DLL,NM,8,returns outstanding trap data that the caller has notreceived if trap reception is enabled.SnmpMgrOidToStr,MGMTAPI.DLL,NM,2 converts an internal object identifier to a string objectidentifier or object descriptor representation.SnmpMgrOpen,MGMTAPI.DLL,NM,4, initializes communications sockets and data structures,allowing communications with the specified agent.SnmpMgrRequest,MGMTAPI.DLL,NM,5, requests the specified operation be performed withthe specified agent.SnmpMgrStrToOid,MGMTAPI.DLL,NM,2, converts an internal object identifier to a string objectidentifier or object descriptor representation.SnmpMgrTrapListen,MGMTAPI.DLL,NM,1, registers the ability of a manager application toreceive SNMP traps.SnmpUtilMemAlloc,SNMPAPI.DLL,NM,1, allocates dynamic memory from the process heap.SnmpUtilMemFree,SNMPAPI.DLL,NM,1, frees the specified memory object.SnmpUtilMemReAlloc,SNMPAPI.DLL,NM,2, changes the size of the specified memory object.SnmpUtilOidAppend,SNMPAPI.DLL,NM,2, appends the source object identifier to thedestination object identifier.SnmpUtilOidCmp,SNMPAPI.DLL,NM,2, compares two object identifiers.SnmpUtilOidCpy,SNMPAPI.DLL,NM,2 copies the variable pointed to by theSrcObjId parameterto the DestObjId parameter, allocating anynecessary memory for the destination?s copy.SnmpUtilOidFree,SNMPAPI.DLL,NM,1, frees any allocated data associated with the objectidentifier.SnmpUtilOidNCmp,SNMPAPI.DLL,NM,3, compares two object identifier variables up to thelength specified by the Len parameter.SnmpUtilPrintAsnAny,SNMPAPI.DLL,NM,1, prints the value of the Any parameter to thestandard output.

SnmpUtilVarBindCpy,SNMPAPI.DLL,NM,2 copies the RFC1157VarBindstructure, and allocatesany memory necessary for the destinationstructure.SnmpUtilVarBindFree,SNMPAPI.DLL,NM,1 frees any allocated data associated with anRFC1157VarBind structure.SnmpUtilVarBindListCpy,SNMPAPI.DLL,NM,2 copies the RFC1157VarBindListstructure, andallocates any necessary memory for the destination'scopy.SnmpUtilVarBindListFree,SNMPAPI.DLL,NM,1, frees any allocated data associated with anRFC1157VarBindList structure.socket,WS2_32.DLL,NM,3 creates a socket that is bound to a specific service provider.socket,WSOCK32.DLL,NM,3 creates a socket that is bound to a specific service provider.SplitSymbols,IMAGEHLP.DLL,NM,4, strips symbols from the specified image.SpoolerCopyFileEvent,MSCMS.DLL,NM,3,graphics, GraphicsDrivers, Reference,SpoolerCopyFileEventSQLAllocConnect,ODBC32.DLL,NM,2 ObsoleteSQLAllocEnv,ODBC32.DLL,NM,1 ObsoleteSQLAllocHandle,ODBC32.DLL,NM,3 Obtains an environment, connection, statement, ordescriptor handle.SQLAllocHandleStd,ODBC32.DLL,NM,3 Default SQLAllocHandle routineSQLAllocStmt,ODBC32.DLL,NM,2 ObsoleteSQLBindCol,ODBC32.DLL,NM,6 Assigns storage for a result column and specifies the datatype.SQLBindParam,ODBC32.DLL,NM,8 ObsoleteSQLBindParameter,ODBC32.DLL,NM,10 Assigns storage for a parameter in an SQLstatement.SQLBrowseConnect,ODBC32.DLL,AW,6 Returns successive levels of connection attributesand valid attribute valuesSQLBulkOperations,ODBC32.DLL,NM,2 Performs bulk insertions and bulk bookmarkoperations, including update, delete, and fetch by bookmark.SQLCancel,ODBC32.DLL,NM,1 Cancels an SQL statement.SQLCloseCursor,ODBC32.DLL,NM,1 Closes a cursor that has been opened on a statementhandle.SQLColAttribute,ODBC32.DLL,AW,7, returns descriptor information for a column in a result set.Descriptor information is returned as a character string, a 32-bit descriptor-dependent value, oran integer value.SQLColAttributes,ODBC32.DLL,AW,7 ObsoleteSQLColumnPrivileges,ODBC32.DLL,AW,9 Returns a list of columns and associated privilegesfor one or more tables.SQLColumns,ODBC32.DLL,AW,9 Returns the list of column names in specified tables.SQLConnect,ODBC32.DLL,AW,7 Connects to a specific driver by data source name, user ID,and password.SQLCopyDesc,ODBC32.DLL,NM,2 copies descriptor information from one descriptor handle toanother.SQLDataSources,ODBC32.DLL,AW,8 Returns the list of available data sources.SQLDescribeCol,ODBC32.DLL,AW,9 Describes a column in the result set.SQLDescribeParam,ODBC32.DLL,NM,6 Returns the description for a specific parameter in astatement.SQLDisconnect,ODBC32.DLL,NM,1 Closes the connection.SQLDriverConnect,ODBC32.DLL,AW,8 Connects to a specific driver by connection string orrequests that the Driver Manager and driver display connection dialog boxes for the user.SQLDrivers,ODBC32.DLL,AW,8 Returns the list of installed drivers and their attributes.SQLEndTran,ODBC32.DLL,NM,3 Commits or rolls back a transaction.SQLError,ODBC32.DLL,AW,8 Returns error or status information.SQLExecDirect,ODBC32.DLL,AW,3 Executes a statement.SQLExecute,ODBC32.DLL,NM,1 Executes a prepared statement.SQLExtendedFetch,ODBC32.DLL,NM,5 fetches the specified rowset of data from the result setand returns data for all bound columns.SQLFetch,ODBC32.DLL,NM,1 Returns multiple result rows.SQLFetchScroll,ODBC32.DLL,NM,3 fetches the specified rowset of data from the result set andreturns data for all bound columns.SQLForeignKeys,ODBC32.DLL,AW,13 Returns a list of column names that make up foreignkeys, if they exist for a specified table.SQLFreeConnect,ODBC32.DLL,NM,1 ObsoleteSQLFreeEnv,ODBC32.DLL,NM,1 ObsoleteSQLFreeHandle,ODBC32.DLL,NM,2 Releases an environment, connection, statement, ordescriptor handle.SQLFreeStmt,ODBC32.DLL,NM,2 Ends statement processing, discards pending results, and,optionally, frees all resources associated with the statement handle.SQLGetConnectAttr,ODBC32.DLL,AW,5 Returns the value of a connection attribute.SQLGetConnectOption,ODBC32.DLL,AW,3 ObsoleteSQLGetCursorName,ODBC32.DLL,AW,4 Returns the cursor name associated with a statementhandle.SQLGetData,ODBC32.DLL,NM,6 Returns part or all of one column of one row of a result setSQLGetDescField,ODBC32.DLL,AW,6 Returns the value of a single descriptor field.SQLGetDescRec,ODBC32.DLL,AW,11 Returns the values of multiple descriptor fields.SQLGetDiagField,ODBC32.DLL,AW,7 Returns additional diagnostic informationSQLGetDiagRec,ODBC32.DLL,AW,8 Returns additional diagnostic informationSQLGetEnvAttr,ODBC32.DLL,NM,5 Returns the value of an environment attribute.SQLGetFunctions,ODBC32.DLL,NM,3 Returns supported driver functionsSQLGetInfo,ODBC32.DLL,AW,5 Returns information about a specific driver and data source.SQLGetStmtAttr,ODBC32.DLL,AW,5 Returns the value of a statement attribute.SQLGetStmtOption,ODBC32.DLL,NM,3 ObsoleteSQLGetTypeInfo,ODBC32.DLL,AW,2 Returns information about supported data types.SQLMoreResults,ODBC32.DLL,NM,1 Determines whether there are more result sets availableand, if so, initializes processing for the next result set.SQLNativeSql,ODBC32.DLL,AW,6 Returns the text of an SQL statement as translated by thedriver.SQLNumParams,ODBC32.DLL,NM,2 Returns the number of parameters in a statement.SQLNumResultCols,ODBC32.DLL,NM,2 Returns the number of columns in the result set.SQLParamData,ODBC32.DLL,NM,2 Used in conjunction with SQLPutData to supply parameterdata at execution time.SQLParamOptions,ODBC32.DLL,NM,3 ObsoleteSQLPrepare,ODBC32.DLL,AW,3 Prepares an SQL statement for later execution.SQLPrimaryKeys,ODBC32.DLL,AW,7 Returns the list of column names that make up theprimary key for a table.SQLProcedureColumns,ODBC32.DLL,AW,9 Returns the list of input and output parameters, aswell as the columns that make up the result set for the specified procedures.SQLProcedures,ODBC32.DLL,AW,7 Returns the list of procedure names stored in a specificdata source.SQLPutData,ODBC32.DLL,NM,3 Sends part or all of a data value for a parameter.SQLRowCount,ODBC32.DLL,NM,2 Returns the number of rows affected by an insert, update,or delete request.SQLSetConnectAttr,ODBC32.DLL,AW,4 Sets a connection attribute.SQLSetConnectOption,ODBC32.DLL,AW,3 ObsoleteSQLSetCursorName,ODBC32.DLL,AW,3 Specifies a cursor name.SQLSetDescField,ODBC32.DLL,AW,5 sets the value of a single field of a descriptor record.SQLSetEnvAttr,ODBC32.DLL,NM,4 Sets an environment attribute.SQLSetParam,ODBC32.DLL,NM,8 ObsoleteSQLSetPos,ODBC32.DLL,NM,4 Positions a cursor within a fetched block of data, and allows anapplication to refresh data in the rowset, or update or delete data in the result set.

Page 151: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

151SQLSetScrollOptions,ODBC32.DLL,NM,4 Sets options that control cursor behavior.SQLSetStmtAttr,ODBC32.DLL,AW,4 Sets a statement attribute.SQLSetStmtOption,ODBC32.DLL,NM,3 ObsoleteSQLSpecialColumns,ODBC32.DLL,AW,10 Returns information about the optimal set ofcolumns that uniquely identifies a row in a specified table, or the columns that are automaticallyupdated when any value in the row is updated by a transaction.SQLStatistics,ODBC32.DLL,AW,9 Returns statistics about a single table and the list of indexesassociated with the table.SQLTablePrivileges,ODBC32.DLL,AW,7 Returns a list of tables and the privileges associatedwith each table.SQLTables,ODBC32.DLL,AW,9 Returns the list of table names stored in a specific data source.SQLTransact,ODBC32.DLL,NM,3 ObsoleteStackWalk,IMAGEHLP.DLL,NM,9,The StackWalk64 function provides a portable method forobtaining a stack trace.StartCAP,CAP.DLL,NM,0,Clear profiling data and start profiling.StartDoc,GDI32.DLL,AW,2, starts a print job.StartDocPrinter,WINMM.DLL,AW,3, informs the print spooler that a document is to be spooledfor printing.StartPage,GDI32.DLL,NM,1, prepares the printer driver to accept data.StartPagePrinter,WINMM.DLL,NM,1, informs the spooler that a page is about to be printed onthe specified printer.StartService,ADVAPI32.DLL,AW,3, starts a service.StartServiceCtrlDispatcher,ADVAPI32.DLL,AW,1StgCreateDocfile,OLE32.DLL,NM,4, creates a new compound file storage object using theCOM-provided compound file implementation for the IStorage interface.StgCreateDocfileOnILockBytes,OLE32.DLL,NM,4,Creates and opens a new compound filestorage object on top of a byte-array object provided by the caller.StgCreatePropSetStg,IPROP.DLL,NM,3,Creates a property set storage object from a specifiedstorage object.StgCreatePropStg,IPROP.DLL,NM,6,Creates and opens a property set in a specified storage orstream object.StgGetIFillLockBytesOnFile,OLE32.DLL,NM,2,Opens a wrapper object on a temporary file.StgGetIFillLockBytesOnILockBytes,OLE32.DLL,NM,2,Creates a new wrapper object on a bytearray object provided by the caller.StgIsStorageFile,OLE32.DLL,NM,1, indicates whether a particular disk file contains a storageobject.StgIsStorageILockBytes,OLE32.DLL,NM,1, indicates whether the specified byte array containsa storage object.StgOpenAsyncDocfileOnIFillLockBytes,OLE32.DLL,NM,4,Opens an existing root asynchronousstorage object on a byte-array wrapper object provided by the caller.StgOpenLayoutDocfile,DFLAYOUT.DLL,NM,4,Opens a compound file on an ILockBytesimplementation that is capable of monitoring sector data.StgOpenPropStg,IPROP.DLL,NM,5,Opens a specified property set in a specified storage orstream object.StgOpenStorage,OLE32.DLL,NM,6, opens an existing root storage object in the file system.StgOpenStorageOnILockBytes,OLE32.DLL,NM,6, opens an existing storage object that doesnot reside in a disk file, but instead has an underlying byte array provided by the caller.StgSetTimes,OLE32.DLL,NM,4, sets the creation, access, and modification times of theindicated file, if supported by the underlying file system.StopCAP,CAP.DLL,NM,0,Stop profiling.StretchBlt,GDI32.DLL,NM,11 copies a bitmap from a source rectangle into a destinationrectangle, stretching or compressing the bitmap to fit the dimensions of the destinationrectangle, if necessary.StretchDIBits,GDI32.DLL,NM,13 copies the color data for a rectangle of pixels in a device-independent bitmap (DIB) to the specified destination rectangle.StringFromCLSID,OLE32.DLL,NM,2,Converts a CLSID into a string of printable characters.Different CLSIDs always convert to different strings.StringFromGUID2,OLE32.DLL,NM,3,Converts a globally unique identifier (GUID) into a string ofprintable characters.StringFromIID,OLE32.DLL,NM,2, Interface identifier to be converted.StrokeAndFillPath,GDI32.DLL,NM,1 closes any open figures in a path,strokes the outline of thepath by using the current pen, and fillsits interior by using the current brush.StrokePath,GDI32.DLL,NM,1 renders the specified path by using the current pen.SubmitNtmsOperatorRequest,NTMSAPI.DLL,AW,6, submits an RSM operator request.SubtractRect,USER32.DLL,NM,3, obtains the coordinates of a rectangle determined bysubtracting one rectangle from another.SuspendThread,KERNEL32.DLL,NM,1, suspends the specified thread.SwapBuffers,GDI32.DLL,NM,1 exchanges the front and back buffers ifthe current pixel formatfor the window referenced by the specifieddevice context includes a back buffer.SwapNtmsMedia,NTMSAPI.DLL,NM,3, swaps the sides associated with the two specifiedLMIDs. The specified LMIDs must be in the same media pool.SwitchDesktop,USER32.DLL,NM,1, makes a desktop visible and activates it.SwitchToFiber,KERNEL32.DLL,NM,1, schedules a fiber.SwitchToThread,KERNEL32.DLL,NM,0 causes the calling thread to yieldexecution to anotherthread that is ready to run on the currentprocessor.SymCleanup,IMAGEHLP.DLL,NM,1, deallocates all resources associated with the processhandle.SymEnumerateModules,IMAGEHLP.DLL,NM,3,The SymEnumerateModules64 functionenumerates all modules that have been loaded for the process by the SymLoadModule64 orSymLoadModuleEx function.SymEnumerateSymbols,IMAGEHLP.DLL,NM,4,The SymEnumerateSymbols64 functionenumerates all the symbols for a specified module.SymFunctionTableAccess,IMAGEHLP.DLL,NM,2,The SymFunctionTableAccess64 functionretrieves the function table entry for the specified address.SymGetModuleBase,IMAGEHLP.DLL,NM,2,The SymGetModuleBase64 function retrieves thebase address of the module that contains the specified address.SymGetModuleInfo,IMAGEHLP.DLL,NM,3,The SymGetModuleInfo64 function retrieves themodule information of the specified module.SymGetOptions,IMAGEHLP.DLL,NM,0, retrieves the current options mask.SymGetSearchPath,IMAGEHLP.DLL,NM,3, retrieves the symbol search path for the specifiedprocess.SymGetSymFromAddr,IMAGEHLP.DLL,NM,4,The SymGetSymFromAddr64 function locatesthe symbol for the specified address.SymGetSymFromName,IMAGEHLP.DLL,NM,3,The SymGetSymFromName64 function locatesa symbol for the specified name.SymGetSymNext,IMAGEHLP.DLL,NM,2,The SymGetSymNext64 function retrieves the symbolinformation of the next symbol.SymGetSymPrev,IMAGEHLP.DLL,NM,2,The SymGetSymPrev64 function retrieves the symbolinformation of the previous symbol.SymInitialize,IMAGEHLP.DLL,NM,3, initializes the symbol handler for a process.SymLoadModule,IMAGEHLP.DLL,NM,6,The SymLoadModule64 function loads the symboltable.SymRegisterCallback,IMAGEHLP.DLL,NM,4,The SymRegisterCallback64 function lets anapplication register a callback function for use by the symbol handler.SymSetOptions,IMAGEHLP.DLL,NM,1, sets the options mask.SymSetSearchPath,IMAGEHLP.DLL,NM,2, sets the search path for the specified process.SysAllocString,OLEAUT32.DLL,NM,1,LenAllocates a new string, copies cch characters fromthe passed string into it, and then appends a null character.

SysAllocStringByteLen,OLEAUT32.DLL,NM,2,Takes an ANSI string as input, and returns aBSTR that contains an ANSI string. Does not perform any ANSI-to-Unicode translation.SysAllocStringLen,OLEAUT32.DLL,NM,2,Allocates a new string, copies cch characters fromthe passed string into it, and then appends a null character.SysFreeString,OLEAUT32.DLL,NM,1,Deallocates a string allocated previously bySysAllocString, SysAllocStringByteLen, SysReAllocString, SysAllocStringLen, orSysReAllocString,OLEAUT32.DLL,NM,2,Len This function creates a new BSTR that contains aspecified number of characters from an old BSTR, and frees the old BSTR.SysReAllocStringLen,OLEAUT32.DLL,NM,3, This function creates a new BSTR that contains aspecified number of characters from an old BSTR, and frees the old BSTR.SysStringByteLen,OLEAUT32.DLL,NM,1,Returns the length (in bytes) of a BSTR. Valid for 32-bit systems only.SysStringLen,OLEAUT32.DLL,NM,1,Returns the length of a BSTR.SystemParametersInfo,USER32.DLL,AW,4, queries or sets systemwide parameters.SystemTimeToFileTime,KERNEL32.DLL,NM,2, converts a system time to a file time.SystemTimeToTzSpecificLocalTime,KERNEL32.DLL,NM,3 converts a Coordinated UniversalTime (UTC) to a specified time zone?s corresponding local time.SystemTimeToVariantTime,OLEAUT32.DLL,NM,2,Converts a system time to a variantrepresentation.SzFindCh,MAPI32.DLL,NM,2, searches for an exact match only; it is sensitive to case anddiacritical differences.SzFindLastCh,MAPI32.DLL,NM,2, searches for an exact match only; it is sensitive to case anddiacritical differences.SzFindSz,MAPI32.DLL,NM,2, searches for an exact match only; it is sensitive to case anddiacritical differences.TabbedTextOut,USER32.DLL,AW,8 writes a character string at a specifiedlocation, expandingtabs to the values specified in an array oftab-stop positions.tapiGetLocationInfo,TAPI32.DLL,AW,2 returns the country code and city(area) code that theuser has set in the current locationparameters in the Telephony Control Panel.tapiRequestDrop,TAPI32.DLL,NM,2 is nonfunctional in Win32 -basedapplications and obsoletefor all classes of Windows-basedapplications.tapiRequestMakeCall,TAPI32.DLL,AW,4, requests the establishment of a voice call.tapiRequestMediaCall,TAPI32.DLL,AW,10 is nonfunctional in Win32-basedapplications andobsolete for all classes of Windows-basedapplications.TerminateProcess,KERNEL32.DLL,NM,2, terminates the specified process and all of itsthreads.TerminateThread,KERNEL32.DLL,NM,2, terminates a thread.TextOut,GDI32.DLL,AW,5 writes a character string at the specified location, using the currentlyselected font.Thread32First,TOOLHELP.DLL,NM,2, retrieves information about the first thread of anyprocess encountered in a system snapshot.Thread32Next,TOOLHELP.DLL,NM,2, retrieves information about the next thread of anyprocess encountered in the system memory snapshot.TileWindows,USER32.DLL,NM,5, tiles the specified windows, or the child windows of thespecified parent window.timeBeginPeriod,WINMM.DLL,NM,1, sets the minimum timer resolution for an application ordevice driver.timeEndPeriod,WINMM.DLL,NM,1, clears a previously set minimum timer resolution.timeGetDevCaps,WINMM.DLL,NM,2, queries the timer device to determine its resolution.timeGetSystemTime,WINMM.DLL,NM,2, retrieves the system time, in milliseconds.timeGetTime,WINMM.DLL,NM,0, retrieves the system time, in milliseconds.timeKillEvent,WINMM.DLL,NM,1, cancels a specified timer event.timeSetEvent,WINMM.DLL,NM,5, starts a specified timer event.TlsAlloc,KERNEL32.DLL,NM,0, allocates a thread local storage (TLS) index.TlsFree,KERNEL32.DLL,NM,1, releases a thread local storage (TLS) index, making it availablefor reuse.TlsGetValue,KERNEL32.DLL,NM,1, retrieves the value in the calling thread? s thread localstorage (TLS) slot for a specified TLS index.TlsSetValue,KERNEL32.DLL,NM,2, stores a value in the calling thread?s thread local storage(TLS) slot for a specified TLS index.ToAscii,USER32.DLL,NM,5 translates the specified virtual-key code and keyboard state to thecorresponding Windows character or characters.ToAsciiEx,USER32.DLL,NM,6 translates the specified virtual-key codeand keyboard state tothe corresponding Windows character orcharacters.Toolhelp32ReadProcessMemory,TOOLHELP.DLL,NM,5, copies memory allocated to anotherprocess into an application-supplied buffer.ToUnicode,USER32.DLL,NM,6 translates the specified virtual-key codeand keyboard state tothe corresponding Unicode character orcharacters.ToUnicodeEx,USER32.DLL,NM,7 translates the specified virtual-key codeand keyboard state tothe corresponding Unicode character orcharacters.TrackMouseEvent,COMCTL32.DLL,NM,1 posts messages when the mouse pointer leaves awindow or hovers over a window for a specified amount of time.TrackMouseEvent,USER32.DLL,NM,1 posts messages when the mouse pointer leaves awindow or hovers over a window for a specified amount of time.TrackPopupMenu,USER32.DLL,NM,7, displays a shortcut menu at the specified location andtracks the selection of items on the menu.TrackPopupMenuEx,USER32.DLL,NM,6 displays a shortcut menu at the specified location andtracks the selection of items on the menu.TransactNamedPipe,KERNEL32.DLL,NM,7 combines into a single networkoperation thefunctions that write a message to and read a messagefrom the specified named pipe.TranslateAccelerator,USER32.DLL,AW,3 function processes accelerator keys for menucommands.TranslateBitmapBits,MSCMS.DLL,NM,11, translates the colors of a bitmap having a definedformat so as to produce another bitmap in a requested format.TranslateColors,MSCMS.DLL,NM,6, translates an array of colors from the source color spaceto the destination color space as defined by a colorTranslateMDISysAccel,USER32.DLL,NM,2 processes accelerator keystrokes for window menucommands of the multiple document interface (MDI) child windows associated with thespecified MDI client window.TranslateMessage,USER32.DLL,NM,1, translates virtual-key messages into charactermessages.TranslateName,SECUR32.DLL,AW,5, converts a directory service object name from one formatto another.TranslateURL,URL.DLL,AW,3,Applies common translations to a given URL string, creating anew URL string.TransmitCommChar,KERNEL32.DLL,NM,2 transmits a specified character aheadof anypending data in the output buffer of the specifiedcommunications device.TryEnterCriticalSection,KERNEL32.DLL,NM,1 attempts to enter a critical section withoutblocking.UFromSz,MAPI32.DLL,NM,1, stops converting when it reaches the first character in the stringthat is not a decimal digit.UlAddRef,MAPI32.DLL,NM,1, provides an alternative way to invoke the OLE methodIUnknown::AddRef.UlFromSzHex,MAPI32.DLL,NM,1, converts a null-terminated string of hexadecimal digits intoan unsigned long integer.UlPropSize,MAPI32.DLL,NM,1, obtains the size of a single property value.UlRelease,MAPI32.DLL,NM,1, provides an alternative way to invoke the OLE methodIUnknown::Release.UnDecorateSymbolName,IMAGEHLP.DLL,NM,4, undecorates decorated C++ symbol names.

Page 152: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

152UnhandledExceptionFilter,KERNEL32.DLL,NM,1, passes unhandled exceptions to thedebugger, if the process is being debugged.UnhookWindowsHook,USER32.DLL,NM,2, is obsolete, but is provided for compatibility with 16-bit versions of Windows.UnhookWindowsHookEx,USER32.DLL,NM,1, removes a hook procedure installed in a hookchain by the SetWindowsHookEx function.UninitializeFlatSB,COMCTL32.DLL,NM,1,Uninitializes flat scroll bars for a particular window.UninstallColorProfile,MSCMS.DLL,AW,3,UninstallColorProfile removes a specified color profilefrom a specified computer. Associated files are optionally deleted from the system.UnionRect,USER32.DLL,NM,3, creates the union of two rectangles.UnloadKeyboardLayout,USER32.DLL,NM,1, removes a keyboard layout.UnloadPerfCounterTextStrings,LOADPERF.DLL,AW,2,unloads performance objects andcounters from the system that are identified by the specified application name.UnloadUserProfile,USERENV.DLL,NM,2, unloads a user's profile that was loaded by theLoadUserProfile function. The caller must have administrative privileges on the computer. Formore information, see the Remarks section of the LoadUserProfile function.UnlockFile,KERNEL32.DLL,NM,5, unlocks a file region locked by LockFile.UnlockFileEx,KERNEL32.DLL,NM,5, unlocks a previously locked byte range in an open file.UnlockServiceDatabase,ADVAPI32.DLL,NM,1, unlocks a service control manager database byreleasing the specified lock.UnlockUrlCacheEntryFile,WININET.DLL,AW,2,Unlocks the cache entry that was locked whilethe file was retrieved for use from the cache.UnlockUrlCacheEntryStream,WININET.DLL,NM,2,Closes the stream that has been retrievedusing the RetrieveUrlCacheEntryStream function.UnMapAndLoad,IMAGEHLP.DLL,NM,1, is used to deallocate all resources that are allocated bya previous call to the MapAndLoad function.UnmapDebugInformation,IMAGEHLP.DLL,NM,1, deallocates the memory and resourcesallocated by a call to the MapDebugInformation function.UnmapViewOfFile,KERNEL32.DLL,NM,1, unmaps a mapped view of a file from the callingprocess?s address space.UnpackDDElParam,USER32.DLL,NM,4, unpacks a DDE lParam value received from a postedDDE message.UnrealizeObject,GDI32.DLL,NM,1, resets a logical palette.UnregisterClass,USER32.DLL,AW,2, removes a window class, freeing the memory required forthe class.UnregisterCMM,MSCMS.DLL,AW,2, dissociates a specified ID value from a given colormanagement module dynamic-link library (CMM DLL).UnregisterGPNotification,USERENV.DLL,NM,1, unregisters the specified policy-notificationhandle from receiving policy change notifications.UnregisterHotKey,USER32.DLL,NM,2, frees a hot key previously registered by the callingthread.UnsealMessage,SECUR32.DLL,NM,4, is already documented under another name. For moreinformation, see SpUnsealMessage.UpdateColors,GDI32.DLL,NM,1 updates the client area of the specifieddevice context byremapping the current colors in the client areato the currently realized logical palette.UpdateDCOMSettings,OLE32.DLL,NM,0, This function updates the DCOM configuration aftermodifying the registry settings. void UpdateDCOMSettings(void); Parameters None.Return Values None. Remarks None.UpdateDebugInfoFile,IMAGEHLP.DLL,NM,4, uses the specified information to update thecorresponding fields in the symbol file.UpdateDebugInfoFileEx,IMAGEHLP.DLL,NM,5, uses the specified information to update thecorresponding fields in the symbol file.UpdateNtmsOmidInfo,NTMSAPI.DLL,NM,5, updates the RSM database with label informationimmediately after writing to the newly allocated medium.UpdateResource,KERNEL32.DLL,AW,6, adds, deletes, or replaces a resource in an executablefile.UpdateWindow,USER32.DLL,NM,1 updates the client area of the specified window by sendinga WM_PAINT message to the window if the window?s update region is not empty.URLAssociationDialog,URL.DLL,AW,6,Invokes the unregistered URL protocol dialog box. Thisdialog box allows the user to select an application to associate with a previously unknownprotocolURLDownload,URLMON.DLL,AW,5,ToFile Downloads bits from the Internet and saves them toa file.URLDownloadToCacheFile,URLMON.DLL,AW,6, Downloads data into the Internet cache andreturns the file name of the cache location for retrieving the bits.URLDownloadToFile,URLMON.DLL,AW,5, Downloads bits from the Internet and saves them toa file.UrlMkSetSessionOption,URLMON.DLL,NM,4, Sets options for the current Internet session.URLOpenBlockingStream,URLMON.DLL,AW,5, Creates a blocking type stream object from aURL and downloads the data from the Internet. When the data is downloaded, the clientapplication or control can read it using the IStream::Read method.URLOpenPullStream,URLMON.DLL,AW,4, Creates a pull type stream object from a URL.URLOpenStream,URLMON.DLL,AW,4, Creates a push type stream object from a URL.UuidCompare,RPCRT4.DLL,NM,3, compares two UUIDs.UuidCreate,RPCRT4.DLL,NM,1, creates a new UUID.UuidCreateNil,RPCRT4.DLL,NM,1, creates a nil-valued UUID.UuidEqual,RPCRT4.DLL,NM,3, determines if two UUIDs are equal.UuidFromString,RPCRT4.DLL,AW,2, converts a string to a UUID.UuidHash,RPCRT4.DLL,NM,2 creates a hash value for a UUID.UuidIsNil,RPCRT4.DLL,NM,2 determines if a UUID is a nil-valued UUID.UuidToString,RPCRT4.DLL,AW,2, converts a UUID to a string.ValidateRect,USER32.DLL,NM,2 validates the client area within a rectangle by removing therectangle from the update region of the specified window.ValidateRgn,USER32.DLL,NM,2 validates the client area within a region by removing the regionfrom the current update region of the specified window.VarBoolFromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to bool.VarBoolFromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to bool.VarBoolFromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to bool.VarBoolFromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to BOOLfrom IDispatch.VarBoolFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to bool.VarBoolFromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to bool.VarBoolFromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to bool.VarBoolFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to bool.VarBoolFromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to bool.VarBoolFromStr,OLEAUT32.DLL,NM,4,Converts a variant of type string to bool.VarBoolFromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to bool.VarBoolFromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to bool.VarBoolFromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to bool.VarBstrFromBool,OLEAUT32.DLL,NM,4,Converts a variant of type bool to BSTR.VarBstrFromCy,OLEAUT32.DLL,NM,5,Converts a variant of type currency to BSTR.VarBstrFromDate,OLEAUT32.DLL,NM,5,Converts a variant of type date to BSTR.VarBstrFromDec,OLEAUT32.DLL,NM,4, Converts a variant of type decimal to BSTR.VarBstrFromDisp,OLEAUT32.DLL,NM,4,Converts a variant of type IDispatch to BSTR.VarBstrFromI1,OLEAUT32.DLL,NM,4,Converts a variant of type char to BSTR.VarBstrFromI2,OLEAUT32.DLL,NM,4,This function converts variant data types to BSTR fromshort.VarBstrFromI4,OLEAUT32.DLL,NM,4,Converts a variant of type long to BSTR.VarBstrFromR4,OLEAUT32.DLL,NM,4,Converts a variant of type float to BSTR.

VarBstrFromR8,OLEAUT32.DLL,NM,5,Converts a variant of type double to BSTR.VarBstrFromUI1,OLEAUT32.DLL,NM,4,Converts a variant of type unsigned char to BSTR.VarBstrFromUI2,OLEAUT32.DLL,NM,4,Converts a variant of type unsigned short to BSTR.VarBstrFromUI4,OLEAUT32.DLL,NM,4,Converts a variant of type unsigned long to BSTR.VarCyFromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to curency.VarCyFromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to curency.VarCyFromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to curency.VarCyFromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types toCURRENCY from IDispatch.VarCyFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to currency.VarCyFromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to curency.VarCyFromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to curency.VarCyFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to curency.VarCyFromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to curency.VarCyFromStr,OLEAUT32.DLL,NM,4,This function converts variant data types to fromOLECHAR.VarCyFromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to curency.VarCyFromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to currency.VarCyFromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to currency.VarDateFromBool,OLEAUT32.DLL,NM,2,converts variant data types to DATE from BOOL.VarDateFromCy,OLEAUT32.DLL,NM,3,converts variant data types to DATE from currencyVarDateFromDec,OLEAUT32.DLL,NM,2, converts variant data types to DATE from decimalVarDateFromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch to date.VarDateFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to date.VarDateFromI2,OLEAUT32.DLL,NM,2,converts variant data types to DATE from shortVarDateFromI4,OLEAUT32.DLL,NM,2,This function converts variant data types to DATE fromlong.VarDateFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to date.VarDateFromR8,OLEAUT32.DLL,NM,3,This function converts variant data types to DATE fromdouble.VarDateFromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to date.VarDateFromUdate,OLEAUT32.DLL,NM,3,Converts a time and date converted from MS-DOSformat to variant format.VarDateFromUI1,OLEAUT32.DLL,NM,2,converts variant data types to DATE from unsignedchar.VarDateFromUI2,OLEAUT32.DLL,NM,2,This function converts variant data types to DATE fromunsigned short.VarDateFromUI4,OLEAUT32.DLL,NM,2,This function converts variant data types to DATE fromunsigned long.VarDecFromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to decimal.VarDecFromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to decimal.VarDecFromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to decimal.VarDecFromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to DECIMALfrom IDispatch.VarDecFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to decimal.VarDecFromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to decimal.VarDecFromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to decimal.VarDecFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to decimal.VarDecFromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to decimal.VarDecFromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to decimal.VarDecFromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to decimal.VarDecFromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to decimal.VarDecFromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to decimal.VarI1FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type BOOL to char.VarI1FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to char.VarI1FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to char.VarI1FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to char.VarI1FromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to char fromIDispatch.VarI1FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to char.VarI1FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to char.VarI1FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to char.VarI1FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to char.VarI1FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to char.VarI1FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to char.VarI1FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to char.VarI1FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to char.VarI2FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to short.VarI2FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to short.VarI2FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to short.VarI2FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to short.VarI2FromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to short fromIDispatch.VarI2FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to short.VarI2FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to short.VarI2FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to short.VarI2FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to short.VarI2FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type string to short.VarI2FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to short.VarI2FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to short.VarI2FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to short.VarI4FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to long.VarI4FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to long.VarI4FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to long.VarI4FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to long.VarI4FromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to long fromIDispatch.VarI4FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to long.VarI4FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to long.VarI4FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to long.VarI4FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to long.VarI4FromStr,OLEAUT32.DLL,NM,4, Converts a variant of type string to long.VarI4FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to long.VarI4FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to long.VarI4FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to long.VariantChangeType,OLEAUT32.DLL,NM,4, This function converts a variant from one type toanotherVariantChangeTypeEx,OLEAUT32.DLL,NM,5,This function converts a variant from one type toanotherVariantClear,OLEAUT32.DLL,NM,1,Clears a variant.VariantCopy,OLEAUT32.DLL,NM,2, Frees the destination variant and makes a copy of thesource variant.VariantCopyInd,OLEAUT32.DLL,NM,2,Frees the destination variant and makes a copy of thesource VARIANTARG, performing the necessary indirection if the source is specified to beVT_BYREF.VariantInit,OLEAUT32.DLL,NM,1,Initializes a variant.VariantTimeToDosDateTime,OLEAUT32.DLL,NM,4,Converts the variant representation of adate and time to MS-DOS date and time values.

Page 153: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

153VariantTimeToSystemTime,OLEAUT32.DLL,NM,3,Converts the variant representation of timeto system time values.VarNumFromParseNum,OLEAUT32.DLL,NM,4,Once the number is parsed, the caller can callVarNumFromParseNum to convert the parse results to a number.VarParseNumFromStr,OLEAUT32.DLL,NM,5,Parses a string, and creates a type-independentdescription of the number it represents.VarR4FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to float.VarR4FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to float.VarR4FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to float.VarR4FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to float.VarR4FromDisp,OLEAUT32.DLL,NM,3, This function converts variant data types to float fromIDispatch.VarR4FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to float.VarR4FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to float.VarR4FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to float.VarR4FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to float.VarR4FromStr,OLEAUT32.DLL,NM,4,This function converts variant data types to float fromOLECHAR.VarR4FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to float.VarR4FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to float.VarR4FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to float.VarR8FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to double.VarR8FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to double.VarR8FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to double.VarR8FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to double.VarR8FromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch to double.VarR8FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to double.VarR8FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to double.VarR8FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to double.VarR8FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to double.VarR8FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to double.VarR8FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to double.VarR8FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to double.VarR8FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to double.VarUdateFromDate,OLEAUT32.DLL,NM,4,Converts a time and date converted from variantformat to MS-DOS format.VarUI1FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type BOOL to an unsigned chartype.VarUI1FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to an unsigned chartype.VarUI1FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to an unsigned chartype.VarUI1FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to an unsigned chartype.VarUI1FromDisp,OLEAUT32.DLL,NM,3, converts variant data types to BYTE fromVarUI1FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to unsigned char.VarUI1FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to an unsigned char type.VarUI1FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to an unsigned char type.VarUI1FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to an unsigned char type.VarUI1FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to an unsigned chartype.VarUI1FromStr,OLEAUT32.DLL,NM,4, converts variant data types to BYTE from BSTR.VarUI1FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to unsignedchar.VarUI1FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to unsignedchar.VarUI2FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to unsigned short.VarUI2FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to unsigned short.VarUI2FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to unsigned short.VarUI2FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to unsigned short.VarUI2FromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch* to unsigned short.VarUI2FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to unsigned short.VarUI2FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to unsigned short.VarUI2FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to unsigned short.VarUI2FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to unsigned short.VarUI2FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to unsigned short.VarUI2FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type string to unsigned short.VarUI2FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to unsignedshort.VarUI2FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to unsignedshort.VarUI4FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to unsigned long.VarUI4FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to unsigned long.VarUI4FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to unsigned long.VarUI4FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to unsigned long.VarUI4FromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch* to unsigned long.VarUI4FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to unsigned long.VarUI4FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to unsigned long.VarUI4FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to unsigned long.VarUI4FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to unsigned long.VarUI4FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to unsigned long.VarUI4FromStr,OLEAUT32.DLL,NM,4,This function converts variant data types to unsignedlong from string.VarUI4FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to unsignedlong.VarUI4FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to unsignedlong.VectorFromBstr,OLEAUT32.DLL,NM,2,Returns a vector, assigning each character in the BSTRto an element of the vector.VerFindFile,VERSION.DLL,AW,8, determines where to install a file based on whether it locatesanother version of the file in the system.VerifySignature,SECUR32.DLL,NM,4, Verifies the signature.VerInstallFile,VERSION.DLL,AW,8 function attempts to install the specified file based oninformation returned from the VerFindFile function.VerLanguageName,KERNEL32.DLL,AW,3 retrieves a description string for the languageassociated with a specified binary Microsoft language identifier.VerQueryValue,VERSION.DLL,AW,4, returns selected version information from the specifiedversion-information resource.VirtualAlloc,KERNEL32.DLL,NM,4, reserves or commits a region of pages in the virtual addressspace of the calling process.VirtualAllocEx,KERNEL32.DLL,NM,5, reserves, commits, or both, a region of memory within thevirtual address space of a specified process.VirtualFree,KERNEL32.DLL,NM,3, releases or decommits (or both) a region of pages within thevirtual address space of the calling process.VirtualFreeEx,KERNEL32.DLL,NM,4, releases, decommits, or both, a region of memory withinthe virtual address space of a specified process.VirtualLock,KERNEL32.DLL,NM,2 locks the specified region of the process?s virtual addressspace into memory, ensuring that subsequentaccess to the region will not incur a page fault.

VirtualProtect,KERNEL32.DLL,NM,4 changes the access protection on aregion of committedpages in the virtual address space of thecalling process.VirtualProtectEx,KERNEL32.DLL,NM,5 changes the access protection on a region ofcommitted pages in the virtual address space of a specified process.VirtualQuery,KERNEL32.DLL,NM,3, provides information about a range of pages in the virtualaddress space of the calling process.VirtualQueryEx,KERNEL32.DLL,NM,4, provides information about a range of pages within thevirtual address space of a specified process.VirtualUnlock,KERNEL32.DLL,NM,2 unlocks a specified range of pages inthe virtual addressspace of a process, enabling the system to swapthe pages out to the paging file if necessary.VkKeyScan,USER32.DLL,AW,1 translates a character to the corresponding virtual-key codeand shift state for the current keyboard.VkKeyScanEx,USER32.DLL,AW,2, translates a character to the corresponding virtual-key codeand shift state.WaitCommEvent,KERNEL32.DLL,NM,3, waits for an event to occur for a specifiedcommunications device.WaitForDebugEvent,KERNEL32.DLL,NM,2, waits for a debugging event to occur in a processbeing debugged.WaitForInputIdle,USER32.DLL,NM,2 waits until the given process is waiting for user input withno input pending, or until the time-out interval has elapsed.WaitForMultipleObjects,KERNEL32.DLL,NM,4 function returns when any one or all of thespecified objects are in the signaled state or the time-out interval elapses.WaitForMultipleObjectsEx,KERNEL32.DLL,NM,5 function returns when any one or all of thespecified objects are in the signaled state or the time-out interval elapses or an I/O completionroutine or asynchronous procedure call (APC) is queued to the thread.WaitForNtmsNotification,NTMSAPI.DLL,NM,3, waits for the next object change notification.WaitForNtmsOperatorRequest,NTMSAPI.DLL,NM,3, waits for the specified RSM operatorrequest.WaitForSingleObject,KERNEL32.DLL,NM,2 returns when the specified object is in the signaledstate or the time-out interval elapses.WaitForSingleObjectEx,KERNEL32.DLL,NM,3, returns when The specified object is in thesignaled state. or The time-out interval elapses.WaitMessage,USER32.DLL,NM,0, yields control to other threads when a thread has no othermessages in its message queue.WaitNamedPipe,KERNEL32.DLL,AW,2 waits until either a time-out interval elapses or aninstance of the specified named pipe is available to be connected towaveInAddBuffer,WINMM.DLL,NM,3, sends an input buffer to the given waveform-audio inputdevice.waveInClose,WINMM.DLL,NM,1, closes the given waveform-audio input device.waveInGetDevCaps,WINMM.DLL,AW,3, retrieves the capabilities of a given waveform-audioinput device.waveInGetErrorText,WINMM.DLL,AW,3, retrieves a textual description of the error identified bythe given error number.waveInGetID,WINMM.DLL,NM,2, gets the device identifier for the given waveform-audio inputdevice.waveInGetNumDevs,WINMM.DLL,NM,0 returns the number of waveform-audio input devicespresent in the system.waveInGetPosition,WINMM.DLL,NM,3, retrieves the current input position of the givenwaveform-audio input device.waveInMessage,WINMM.DLL,NM,4 sends messages to the waveform-audio, WaveformFunctionsinput device drivers.waveInOpen,WINMM.DLL,NM,6 opens the given waveformfor recording.waveInPrepareHeader,WINMM.DLL,NM,3, prepares a buffer for waveform- audio input.waveInReset,WINMM.DLL,NM,1 stops input on the given waveform-audio input device andresets the current position to zero.waveInStart,WINMM.DLL,NM,1, starts input on the given waveform-audio input device.waveInStop,WINMM.DLL,NM,1, stops waveform-audio input.waveInUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by thewaveInPrepareHeader function.waveOutBreakLoop,WINMM.DLL,NM,1 breaks a loop on the given waveform-audio outputdevice and allows playback to continue with the nextblock in the driver list.waveOutClose,WINMM.DLL,NM,1 closes the given waveform-audio output device.waveOutGetDevCaps,WINMM.DLL,AW,3, retrieves the capabilities of a given waveform-audiooutput device.waveOutGetErrorText,WINMM.DLL,AW,3, retrieves a textual description of the error identifiedby the given error number.waveOutGetID,WINMM.DLL,NM,2, retrieves the device identifier for the given waveform-audiooutput device.waveOutGetNumDevs,WINMM.DLL,NM,0, retrieves the number of waveform- audio outputdevices present in the system.waveOutGetPitch,WINMM.DLL,NM,2 retrieves the current pitch setting for the specifiedwaveform-audio output device.waveOutGetPlaybackRate,WINMM.DLL,NM,2, retrieves the current playback rate for thespecified waveform-audio output device.waveOutGetPosition,WINMM.DLL,NM,3 retrieves the current playback,position of the givenwaveform-audio output device.waveOutGetVolume,WINMM.DLL,NM,2, retrieves the current volume level of the specifiedwaveform-audio output device.waveOutMessage,WINMM.DLL,NM,4, sends messages to the waveform-audio output devicedrivers.waveOutOpen,WINMM.DLL,NM,6, opens the given waveform-audio output device for playback.waveOutPause,WINMM.DLL,NM,1, pauses playback on the given waveform- audio outputdevice.waveOutPrepareHeader,WINMM.DLL,NM,3 prepares a waveform-audio data block forplayback.waveOutReset,WINMM.DLL,NM,1, stops playback on the given waveform- audio output deviceand resets the current position to zero.waveOutRestart,WINMM.DLL,NM,1, resumes playback on a paused waveform- audio outputdevice.waveOutSetPitch,WINMM.DLL,NM,2, sets the pitch for the specified waveform-audio outputdevice.waveOutSetPlaybackRate,WINMM.DLL,NM,2, sets the playback rate for the specifiedwaveform-audio output device.waveOutSetVolume,WINMM.DLL,NM,2, sets the volume level of the specified waveform-audiooutput device.waveOutUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by thewaveOutPrepareHeader function.waveOutWrite,WINMM.DLL,NM,3, sends a data block to the given waveform- audio outputdevice.wglCopyContext,OPENGL.DLL,NM,3, copies selected groups of rendering states from oneOpenGL rendering context to another.wglCopyContext,OPENGL32.DLL,NM,3, copies selected groups of rendering states from oneOpenGL rendering context to another.wglCreateContext,OPENGL.DLL,NM,1 creates a new OpenGL renderingcontext, which issuitable for drawing on the device referenced byhdc.wglCreateContext,OPENGL32.DLL,NM,1 creates a new OpenGL renderingcontext, which issuitable for drawing on the device referenced byhdc.wglCreateLayerContext,OPENGL.DLL,NM,2, creates a new OpenGL rendering context fordrawing to a specified layer plane on a device context.

Page 154: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

154wglCreateLayerContext,OPENGL32.DLL,NM,2, creates a new OpenGL rendering context fordrawing to a specified layer plane on a device context.wglDeleteContext,OPENGL.DLL,NM,1, deletes a specified OpenGL rendering context.wglDeleteContext,OPENGL32.DLL,NM,1, deletes a specified OpenGL rendering context.wglDescribeLayerPlane,OPENGL.DLL,NM,5, obtains information about the layer planes of agiven pixel format.wglDescribeLayerPlane,OPENGL32.DLL,NM,5, obtains information about the layer planes of agiven pixel format.wglGetCurrentContext,OPENGL.DLL,NM,0, obtains a handle to the current OpenGL renderingcontext of the calling thread.wglGetCurrentContext,OPENGL32.DLL,NM,0, obtains a handle to the current OpenGLrendering context of the calling thread.wglGetCurrentDC,OPENGL.DLL,NM,0 obtains a handle to the device contextthat is associatedwith the current OpenGL rendering context of thecalling thread.wglGetCurrentDC,OPENGL32.DLL,NM,0 obtains a handle to the device contextthat isassociated with the current OpenGL rendering context of thecalling thread.wglGetLayerPaletteEntries,OPENGL.DLL,NM,5 retrieves the paletteentries from a given color-index layer plane for a specified devicecontext.wglGetLayerPaletteEntries,OPENGL32.DLL,NM,5 retrieves the paletteentries from a givencolor-index layer plane for a specified devicecontext.wglGetProcAddress,OPENGL.DLL,NM,1 returns the address of an OpenGLextension functionfor use with the current OpenGL renderingcontext.wglGetProcAddress,OPENGL32.DLL,NM,1 returns the address of an OpenGLextensionfunction for use with the current OpenGL renderingcontext.wglMakeCurrent,OPENGL.DLL,NM,2, makes a specified OpenGL rendering context the callingthread?s current rendering context.wglMakeCurrent,OPENGL32.DLL,NM,2, makes a specified OpenGL rendering context thecalling thread?s current rendering context.wglRealizeLayerPalette,OPENGL.DLL,NM,3 maps palette entries from agiven color-index layerplane into the physical palette orinitializes the palette of an RGBA layer plane.wglRealizeLayerPalette,OPENGL32.DLL,NM,3 maps palette entries from agiven color-indexlayer plane into the physical palette orinitializes the palette of an RGBA layer plane.wglSetLayerPaletteEntries,OPENGL.DLL,NM,5, sets the palette entries in a given color-indexlayer plane for a specified device context.wglSetLayerPaletteEntries,OPENGL32.DLL,NM,5, sets the palette entries in a given color-index layer plane for a specified device context.wglShareLists,OPENGL.DLL,NM,2, enables multiple OpenGL rendering contexts to share asingle display-list space.wglShareLists,OPENGL32.DLL,NM,2, enables multiple OpenGL rendering contexts to share asingle display-list space.wglSwapLayerBuffers,OPENGL.DLL,NM,2, swaps the front and back buffers in the overlay,underlay, and main planes of the window referenced by a specified device context.wglSwapLayerBuffers,OPENGL32.DLL,NM,2, swaps the front and back buffers in the overlay,underlay, and main planes of the window referenced by a specified device context.wglUseFontBitmaps,OPENGL.DLL,AW,4 wglUseFontBitmapscreates a set of bitmapdisplaylists for use in the current OpenGL rendering context.wglUseFontBitmaps,OPENGL32.DLL,AW,4 wglUseFontBitmapscreates a set of bitmapdisplaylists for use in the current OpenGL rendering context.wglUseFontOutlines,OPENGL.DLL,AW,8 creates three-dimensional (3-D) characters based ona TrueType font for use in OpenGL-rendered scenes.wglUseFontOutlines,OPENGL32.DLL,AW,8 creates three-dimensional (3-D) characters basedon a TrueType font for use in OpenGL rendered scenes.WideCharToMultiByte,KERNEL32.DLL,NM,8 maps a wide character string to anew characterstring.WidenPath,GDI32.DLL,NM,1 redefines the current path as the area that would be painted if thepath were stroked using the pen currently selected into the given device context.WindowFromDC,USER32.DLL,NM,1, returns the handle of the window associated with thegiven display device context (DC).WindowFromPoint,USER32.DLL,NM,2, retrieves the handle of the window that contains thespecified point.WinExec,KERNEL32.DLL,NM,2, runs the specified application.WinHelp,USER32.DLL,AW,4, starts Windows Help (WINHELP.WinLoadTrustProvider,WINTRUST.DLL,NM,1, loads a trust provider DLL into the addressspace of the calling process.WinSubmitCertificate,WINTRUST.DLL,NM,1 passes a WIN_CERTIFICATEstructure to all trustproviders registered with the WinTrustservice.WinVerifyTrust,WINTRUST.DLL,NM,3, performs a specified verification action on a specifiedsubject.WNetAddConnection,MPR.DLL,AW,3, enables the calling application to connect a local deviceto a network resource.WNetAddConnection2,MPR.DLL,AW,4, makes a connection to a network resource.WNetAddConnection3,MPR.DLL,AW,5, makes a connection to a network resource.WNetCancelConnection,MPR.DLL,AW,2, breaks an existing network connection.WNetCancelConnection2,MPR.DLL,AW,3, breaks an existing network connection.WNetCloseEnum,MPR.DLL,NM,1, ends a network resource enumeration started by theWNetOpenEnum function.WNetConnectionDialog,MPR.DLL,NM,2, starts a general browsing dialog box for connecting tonetwork resources.WNetConnectionDialog1,MPR.DLL,AW,1, brings up a general browsing dialog for connecting tonetwork resources.WNetDisconnectDialog,MPR.DLL,NM,2, starts a general browsing dialog box for disconnectingfrom network resources.WNetDisconnectDialog1,MPR.DLL,AW,1, attempts to disconnect from a network resource.WNetEnumResource,MPR.DLL,AW,4, continues a network-resource enumeration started bythe WNetOpenEnum function.WNetGetConnection,MPR.DLL,AW,3, retrieves the name of the network resource associatedwith a local device.WNetGetLastError,MPR.DLL,AW,5, retrieves the most recent extended error code set by aWindows network function.WNetGetNetworkInformation,MPR.DLL,AW,2 returns extended informationabout a specificnetwork whose name was returned by a previousnetwork enumeration.WNetGetProviderName,MPR.DLL,AW,3, obtains the provider name for a specific type ofnetwork.WNetGetUniversalName,MPR.DLL,AW,4 takes a drive-based path for a network resource andobtains a data structure that contains a more universal form of the name.WNetGetUser,MPR.DLL,AW,3, retrieves the current default user name or the user name usedto establish a network connection.WNetOpenEnum,MPR.DLL,AW,5, starts an enumeration of network resources or existingconnections.WNetUseConnection,MPR.DLL,AW,8, makes a connection to a network resource.WPUCompleteOverlappedRequest,WS2_32.DLL,NM,5, performs overlapped I/O completionnotification for overlapped I/O operations.WrapCompressedRTFStream,MAPI32.DLL,NM,3 creates a text stream in uncompressed RichText Format (RTF) from the compressed format used in the PR_RTF_COMPRESSEDproperty.WrapStoreEntryID,MAPI32.DLL,NM,6 converts a message store?s internalentry identifier to anentry identifier more usable by themessaging system.WriteClassStg,OLE32.DLL,NM,2, stores the specified class identifier (CLSID) in a storageobject.

WriteClassStm,OLE32.DLL,NM,2, stores the specified CLSID in the stream.WriteConsole,KERNEL32.DLL,AW,5, writes a character string to a console screen bufferbeginning at the current cursor location.WriteConsoleInput,KERNEL32.DLL,AW,4, writes data directly to the console input buffer.WriteConsoleOutput,KERNEL32.DLL,AW,5 writes character and colorattribute data to aspecified rectangular block of character cellsin a console screen buffer.WriteConsoleOutputAttribute,KERNEL32.DLL,NM,5 copies a number of foreground andbackground color attributes to consecutive cells of a console screen buffer, beginning at aspecified location.WriteConsoleOutputCharacter,KERNEL32.DLL,AW,5 copies a number of characters toconsecutive cells of a console screen buffer, beginning at a specified location.WriteFile,KERNEL32.DLL,NM,5, writes data to a file and is designed for both synchronous andasynchronous operation.WriteFileEx,KERNEL32.DLL,NM,5, writes data to a file.WriteFmtUserTypeStg,OLE32.DLL,NM,3, writes a clipboard format and user type to the storageobject.WritePrinter,WINMM.DLL,NM,4, informs the print spooler that data should be written to thespecified printer.WritePrivateProfileSection,KERNEL32.DLL,AW,3, replaces the keys and values under thespecified section in an initialization file.WritePrivateProfileString,KERNEL32.DLL,AW,4, copies a string into the specified section of thespecified initialization file.WritePrivateProfileStruct,KERNEL32.DLL,AW,5, copies data into the to the end of the data.WriteProcessMemory,KERNEL32.DLL,NM,5, writes memory in a specified process.WriteProfileSection,KERNEL32.DLL,AW,2, replaces the contents of the specified section in theWIN.WriteProfileString,KERNEL32.DLL,AW,3, copies a string into the specified section of the WIN.WriteTapemark,KERNEL32.DLL,NM,4, writes a specified number of filemarks, setmarks, shortfilemarks, or long filemarks to a tape device.WSAAccept,WS2_32.DLL,NM,5 accepts a connection based on the return value of a conditionfunction, andoptionally creates or joins a socket group.WSAAddressToString,WS2_32.DLL,AW,5 converts all components of a SOCKADDR structureinto a human-readable stringrepresentation of the address.WSAAsyncGetHostByAddr,WS2_32.DLL,NM,7, asynchronously retrieves host information thatcorresponds to an address.WSAAsyncGetHostByAddr,WSOCK32.DLL,NM,7, is an asynchronous version ofgethostbyaddr.WSAAsyncGetHostByName,WS2_32.DLL,NM,5 cancels an incomplete asynchronousoperation.WSAAsyncGetHostByName,WSOCK32.DLL,NM,5 processing a callback function.WSAAsyncGetProtoByName,WS2_32.DLL,NM,5, asynchronously retrieves protocolinformation that corresponds to a protocol name.WSAAsyncGetProtoByName,WSOCK32.DLL,NM,5, asynchronously retrieves protocolinformation that corresponds to a protocol name.WSAAsyncGetProtoByNumber,WS2_32.DLL,NM,5 asynchronously retrieves protocolinformation corresponding to aprotocol number.WSAAsyncGetProtoByNumber,WSOCK32.DLL,NM,5 asynchronously retrieves protocolinformation corresponding to aprotocol number.WSAAsyncGetServByName,WS2_32.DLL,NM,6 asynchronously retrieves service informationcorresponding to a service name andport.WSAAsyncGetServByName,WSOCK32.DLL,NM,6 asynchronously retrieves serviceinformation corresponding to a service name andport.WSAAsyncGetServByPort,WS2_32.DLL,NM,6 gets serviceinformation corresponding to a portand protocol asynchronously.WSAAsyncGetServByPort,WSOCK32.DLL,NM,6 gets service information corresponding to aport and protocol asynchronously.WSAAsyncSelect,WS2_32.DLL,NM,4, is used to request that WS2_32.WSAAsyncSelect,WSOCK32.DLL,NM,4, is used to request that WS2_32.WSACancelAsyncRequest,WS2_32.DLL,NM,1 cancels an incomplete asynchronous operation.WSACancelAsyncRequest,WSOCK32.DLL,NM,1 cancels an incomplete asynchronousoperation.WSACancelBlockingCall,WS2_32.DLL,NM,0 closes an existing socket.WSACancelBlockingCall,WSOCK32.DLL,NM,0 closes an existing socket.WSACleanup,WS2_32.DLL,NM,0 terminates use of theWS2_32.WSACleanup,WSOCK32.DLL,NM,0 terminates use of theWS2_32.WSACloseEvent,WS2_32.DLL,NM,1 closes an open eventobject handle.WSAConnect,WS2_32.DLL,NM,7 establishes a connection to another socket application,exchanges connect data, and specifies needed quality of service based on the suppliedFLOWSPEC structure.WSACreateEvent,WS2_32.DLL,NM,0 creates a new event object.WSADuplicateSocket,WS2_32.DLL,AW,3, is used to enable socket sharing betweenprocesses.WSAEnumNameSpaceProviders,WS2_32.DLL,AW,2, retrieves information about availablenamespaces.WSAEnumNetworkEvents,WS2_32.DLL,NM,3 discovers occurrences of network events for theindicated socket.WSAEnumProtocols,WS2_32.DLL,AW,3, provides equivalent functionality in Windows Sockets2.WSAEventSelect,WS2_32.DLL,NM,3 specifies an event object to be associated with thesupplied set of FD_XXX network events.WSAGetLastError,WS2_32.DLL,NM,0, returns the error status for the last operation that failed.WSAGetLastError,WSOCK32.DLL,NM,0, returns the error status for the last operation thatfailed.WSAGetOverlappedResult,WS2_32.DLL,NM,5 returns theresults of an overlapped operation onthe specified socket.WSAGetQOSByName,WS2_32.DLL,NM,3 initializes a QUALITYOFSERVICE structure basedon a named template.WSAGetServiceClassInfo,WS2_32.DLL,AW,4 retrieves all of the class information (schema)pertaining to a specified serviceclass from a specified name space provider.WSAGetServiceClassNameByClassId,WS2_32.DLL,AW,3, retrieves the name of the serviceassociated with the specified type. This name is the generic service name, like FTP or SNA,and not the name of a specific instance of that service.WSAHtonl,WS2_32.DLL,NM,3 converts a u_long from hostbyte order to network byte order.WSAHtons,WS2_32.DLL,NM,3 converts a u_short from hostbyte order to network byte order.WSAInstallServiceClass,WS2_32.DLL,AW,1 registers a service class schema within a namespace.WSAIoctl,WS2_32.DLL,NM,9 controls the mode of a socket.WSAIsBlocking,WS2_32.DLL,NM,0 This has been removed in compliance with theWindowsSockets 2 specification, revision 2.WSAIsBlocking,WSOCK32.DLL,NM,0 This has been removed in compliance with theWindowsSockets 2 specification, revision 2.WSAJoinLeaf,WS2_32.DLL,NM,8 joins a leaf node into a multipoint session, exchangesconnect data, and specifies needed quality of service based on the supplied FLOWSPECstructures.WSALookupServiceBegin,WS2_32.DLL,AW,3 ininitiates a client query that is constrained bythe information containedwithin a WSAQUERYSET structure.WSALookupServiceEnd,WS2_32.DLL,NM,1 called to free the handle after previous calls toWSALookupServiceBegin and WSALookupServiceNext .

Page 155: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

155WSALookupServiceNext,WS2_32.DLL,AW,4 called after obtaining a handle from a previouscall to WSALookupServiceBegin in order to retrieve the requested service information.WSANtohl,WS2_32.DLL,NM,3 converts a u_long from network byte order to host byte order.WSANtohs,WS2_32.DLL,NM,3 WSANtohsconverts a u_short fromnetwork byte order to hostbyte order.WSAProviderConfigChange,WS2_32.DLL,NM,3, notifies the application when the providerconfiguration is changed.WSARecv,WS2_32.DLL,NM,7 WSARecvreceives data from a socket.WSARecvDisconnect,WS2_32.DLL,NM,2 terminates receptionon a socket, and retrieves thedisconnect data if the socket isconnection oriented.WSARecvEx,MSWSOCK.DLL,NM,4 The Windows Sockets WSARecvEx function is identical tothe recv function, except the flags parameter is an in-out parameter.WSARecvEx,WSOCK32.DLL,NM,4 The Windows Sockets WSARecvEx function is identical tothe recv function, except the flags parameter is an in-out parameter.WSARecvFrom,WS2_32.DLL,NM,9 receives a datagram andstores the source address.WSARemoveServiceClass,WS2_32.DLL,NM,1 permanently unregisters service class schema.WSAResetEvent,WS2_32.DLL,NM,1, is used to set the state of the event object tononsignaled.WSASend,WS2_32.DLL,NM,7 sends data on a connectedsocket.WSASendDisconnect,WS2_32.DLL,NM,2 initiates termination of the connection for the socketand sends disconnectdata.WSASendTo,WS2_32.DLL,NM,9 sends data to a specificdestination, using overlapped I/Owhere applicable.WSASetBlockingHook,WS2_32.DLL,NM,1 This has been removed in compliance with theWindowsSockets 2 specification, revision 2.WSASetBlockingHook,WSOCK32.DLL,NM,1 This has been removed in compliance with theWindowsSockets 2 specification, revision 2.WSASetEvent,WS2_32.DLL,NM,1, sets the state of the event object to be signaled.WSASetLastError,WS2_32.DLL,NM,1 sets the error code that can be retrieved through theWSAGetLastError function.WSASetLastError,WSOCK32.DLL,NM,1 sets the error code that can be retrieved through theWSAGetLastError function.WSASetService,WS2_32.DLL,AW,3 registers or deregisters a service instance within one ormore name spaces.WSASocket,WS2_32.DLL,AW,6 creates a socket that is bound to a specific transport serviceprovider, and optionally creates and/or joins a socket group.WSAStartup,WS2_32.DLL,NM,2, initiates use of WS2_32.DLL by a process.WSAStartup,WSOCK32.DLL,NM,2, initiates use of WS2_32.DLL by a process.WSAStringToAddress,WS2_32.DLL,AW,5, converts a numeric string to a sockaddr structure,suitable for passing to Windows Sockets routines that take such a structure.

WSAUnhookBlockingHook,WS2_32.DLL,NM,0 This has been removed in compliance with theWindowsSockets 2 specification, revision 2.WSAUnhookBlockingHook,WSOCK32.DLL,NM,0 Thishas been removed in compliance with theWindowsSockets 2 specification, revision 2.WSAWaitForMultipleEvents,WS2_32.DLL,NM,5 returns either when one or all of the specifiedevent objects are in the signaled state, or when the time-out interval expires.WSCDeinstallProvider,WS2_32.DLL,NM,2, removes the specified transport provider from thesystem configuration database.WSCEnableNSProvider,WS2_32.DLL,NM,2, changes the state of a given name-spaceprovider. It is intended to give the end user the ability to change the state of the name-spaceproviders through Control Panel.WSCEnumProtocols,WS2_32.DLL,NM,4, retrieves information about available transportprotocols.WSCGetProviderPath,WS2_32.DLL,NM,4, retrieves the DLL path for the specified provider.WSCInstallNameSpace,WS2_32.DLL,NM,5, installs a name-space provider. For providers thatare able to support multiple names spaces, this function must be called once for everynamespace supported, and a unique provider identifier must be supplied each time.WSCInstallProvider,WS2_32.DLL,NM,5, installs the specified transport provider into the systemconfiguration database.WSCUnInstallNameSpace,WS2_32.DLL,NM,1, uninstalls the indicated name-space provider.WSCWriteProviderOrder,WS2_32.DLL,NM,2, is used to reorder the available transportproviders. The order of the protocols determines the priority of a protocol when beingenumerated or selected for use.wvsprintf,USER32.DLL,AW,3, formats and stores a series of characters and values in a buffer._hread,KERNEL32.DLL,NM,3, reads data from the specified file._hwrite,KERNEL32.DLL,NM,3, writes data to the specified file._lclose,KERNEL32.DLL,NM,1, closes the specified file so that it is no longer available forreading or writing._lcreat,KERNEL32.DLL,NM,2, creates or opens a specified file._llseek,KERNEL32.DLL,NM,3 repositions the file pointer in a previously opened file._lopen,KERNEL32.DLL,NM,2, opens an existing file and sets the file pointer to the beginning ofthe file._lread,KERNEL32.DLL,NM,3, reads data from the specified file._lwrite,KERNEL32.DLL,NM,3, writes data to the specified file.__WSAFDIsSet,WS2_32.DLL,NM,2, specifies whether a socket is included in a set of socketdescriptors.__WSAFDIsSet,WSOCK32.DLL,NM,2, specifies whether a socket is included in a set of socketdescriptors.

.

Sve ove funkcije se pozivaju StdCall pravilima, a funkcije koje se pozivaju po Ccall pravilima (uglavnom funkcije izMicrosoft C runtime biblioteka) nisu navedene u ovoj tabeli. Dato je oko 4800 funkcija. Pored ovoga oko 1000 funkcija saspiska ima ASCII i Unicode verzije. Ali, ni to nije sve, postoji još oko 3000 nedokumentovanih funkcija i oko 2000 funkcijačija imena i način poziva nisu kompatibilni sa FILDZAN-32 (ali se mogu pozvati Inline asemblerom), te ogroman brojCOM/OLE i .NET objekata i metoda, kao i struktura i Windows poruka.

16.4. Portiranje Windows API funkcije

Prilikom upotrebe API funkcije u jeziku koji smo razvili, potrebno je učiniti nekoliko koraka.

• Dobavljanje dokumentacije za API funkcije

Dokumentacija za sve API funkcije navedene u listi se može naći na Internetu (najčešće uz pomoć stranicamsdn.microsoft.com ili www.google.com) ili na dokumentacijskim CD-ovima Microsoft Developer Network Library, ali jeobično ograničena na programski jezik C. Neka je cilj, na primjer, portirati funkciju CopyFile. Dokumentacija za ovu funkcijuizgleda ovako:

CopyFileThe CopyFile function copies an existing file to a new file.BOOL CopyFile( LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists);

ParameterslpExistingFileName [in] Pointer to a null-terminated string that s pecifies the name of an existing file. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend

this limit to 32,767 wide characters, call the Unic ode version of the function and prepend "\\?\" to t hepath. For more information, see Naming a File.

Windows Me/98/95: This string must not exc eed MAX_PATH characters. If lpExistingFileName does not exist, CopyFile fails, and GetLastError returns

ERROR_FILE_NOT_FOUND.lpNewFileName [in] Pointer to a null-terminated string that s pecifies the name of the new file. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend

this limit to 32,767 wide characters, call the Unic ode version of the function and prepend "\\?\" to t hepath. For more information, see Naming a File.

Windows Me/98/95: This string must not exc eed MAX_PATH characters.

Page 156: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

156bFailIfExists [in] If this parameter is TRUE and the new file specified by lpNewFileName already exists, the

function fails. If this parameter is FALSE and the new file already exists, the function overwrites th eexisting file and succeeds.

Return ValuesIf the function succeeds, the return value is nonze ro.If the function fails, the return value is zero. To get extended error information, call

GetLastError.RemarksSecurity attributes for the existing file are not c opied to the new file. To copy security

attributes, use the SHFileOperation function.File attributes for the existing file are copied to the new file. For example, if an existing file

has the FILE_ATTRIBUTE_READONLY file attribute, a c opy created through a call to CopyFile will also ha vethe FILE_ATTRIBUTE_READONLY file attribute. For mor e information, see Retrieving and Changing FileAttributes.

This function fails with ERROR_ACCESS_DENIED if the destination file already exists and has theFILE_ATTRIBUTE_HIDDEN or FILE_ATTRIBUTE_READONLY at tribute set.

When CopyFile is used to copy an encrypted file, it attempts to encrypt the destination file withthe keys used in the encryption of the source file. If this cannot be done, this function attempts toencrypt the destination file with default keys, as in Windows 2000. If neither of these methods can bedone, CopyFile fails with an ERROR_ENCRYPTION_FAILE D error code.

Windows 2000 : When CopyFile is used to copy an encrypted file, the function attempts toencrypt the destination file with the default keys. No attempt is made to encrypt the destination filewith the keys used in the encryption of the source file. If it cannot be encrypted, CopyFile completes thecopy operation without encrypting the destination f ile.

Example Code

For an example, see Retrieving and Changing File At tributes.RequirementsClient Requires Windows "Longhorn", Windows XP, Win dows 2000 Professional, Windows NT Workstation,

Windows Me, Windows 98, or Windows 95.Server Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT

Server.Header Declared in Winbase.h; include Windows.h.Library Link to Kernel32.lib.DLL Requires Kernel32.dll.Unicode Implemented as CopyFileW (Unicode) and CopyFileA (A NSI). Note that Unicode support on Windows

Me/98/95 requires Microsoft Layer for Unicode.

See Also

• Konverzija imena, tipova argumenata i konstanti

Kako u tabeli funkcija uz ovu funkciju stoji oznaka AW, ime funkcije će biti CopyFileA, jer u FILDZAN-32 se radisa ASCII stringovima.

Tipovi argumenata se najčešće portiraju u cijele brojeve i pointere. Windows koristi predefinisane tipove koji seobično mogu naći na web stranici

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp

Na ovoj stranici je nađeno da su dva tipa koji se koriste u CopyFile funkciji LPCTSTR i BOOL, deklarisana kao

typedef __nullterminated CONST CHAR *LPCSTR;#ifdef UNICODE typedef LPCWSTR LPCTSTR;#else typedef LPCSTR LPCTSTR;#endif

typedef int BOOL;

Iz ovog se vidi da se tip “BOOL” transformiše u tip “cijeli” a tip “LPCTSTR” u tip “karakter *”.

U dokumentaciji se spominju i neke konstante, kao što su FILE_ATTRIBUTE_HIDDEN ,FILE_ATTRIBUTE_READONLY,ERROR_ENCRYPTION_FAILED,ERROR_FILE_NOT_FOUND,ERROR_ACCESS_DENIED, MAX_PATH. Ako će se ove konstante koristiti, treba portirati i njihove vrijednosti. Vrijednosti je najlakše naći akona Internet pretraživaču, npr. www.google.com unesemo #define sa imenom konstante, npr.

#define ERROR_FILE_NOT_FOUND

Mrežni pretraživač će vratiti da ova konstanta ima vrijednost jednaku 2.

• Pravljenje deklaracije

Sada se može napisati deklaracija funkcije i pripadnih konstanti. Tipovi u C se zamijene ekvivalentnim tipovima uFILDZAN-32 i redoslijed argumenata se izvrne, zbog razlike u Pascal Call i StdCall.

Page 157: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

157#definiraj ERROR_FILE_NOT_FOUND 2

cijeli funkcija CopyFileA( cijeli bFailIfExists karakter * lpNewFileName, karakter * lpExistingFileName,);

• Upotreba funkcije

U istom listingu u kome je deklaracija može se pozvati funkcija. Evo kao primjer cijelog programa:

#definiraj ERROR_FILE_NOT_FOUND 2

cijeli funkcija CopyFileA( cijeli bFailIfExists karakter * lpNewFileName, karakter * lpExistingFileName,);{ CopyFileA(0,”KopijaPodaci.Txt”,”Podaci.txt”);}

Primjer se prevede i asemblira kao i ostali primjeri.

Prilikom linkovanja mora se paziti da imamo ekvivalentnu MASM biblioteku sa ekstenzijom LIB datoteci saekstenzijom DLL u kojoj je definisana funkcija. Funkcija CopyFile je definisana u kernel32.dll, pa se pripaja kernel32.lib.

link /defaultlib:kernel32.lib /subsystem:console primjer.obj

16.5. Rezime poglavlja

Windows API ima veliki broj funkcija koje se mogu koristiti u raznim programskim jezicima. One su običnodefinisane za programski jezik C. Kod novih programskih jezika obično je potrebno, ali i moguće, prilagoditi pozive iz ovihbiblioteka osobinama programskog jezika. To je posao lakši od pravljenja novih biblioteka. U slučaju FILDZAN-32, trebaprilagoditi ime funkcije, nazive tipova, konstante te redoslijed argumenata.

Page 158: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

158

17. ASEMBLER

Kompajler koji je razvijen u okviru ovog kursa generiše asemblerski listing, a ne prirodni mašinski kod. Zaprevođenje iz asemblerskog jezika u mašinski jezik iskorišten je Microsoftov Macro asembler. Sada slijedi razvoj asemblera,programa koji treba da prevede iz asemblerskog listinga u mašinski jezik. Prvo je potrebno navesti spisak svih instrukcija kojeovaj procesor poznaje

17.1. Instrukcijski set Pentiuma II

Tipična instrukcija mikroprocesora Pentium II izgleda kao na slici Sl. 17.1.1:

Instruction Format +-----------+-----------+-----------+-----------+ -----------+-----------+ | | | | | | | | Prefixes | Opcode | ModR/M | SIB | Disp | immediate | | | | | | | | +-----------+-----------+-----------+-----------+ -----------+-----------+

Sl. 17.1.1. Format instrukcijaPrefixes : Nula do četiri prefiksa velika po jedan bajt: (LOCK | REP | REPE | REPZ | REPNE | REPZ) (CS | SS | DS | ES | FS |GS) (66) (67)Opcode: 1 ili 2 bajtni operacioni kodModR/M: Biti 7..6 predstavljaju Mode, biti 2..0 sadrže kod registra ili memorijskog režima koji je indiciran modom, biti 5..3su rezervno poljeSIB Biti 7..6 su faktor skaliranja, 5..3 je Index, 2..0 je BazaDisp: Opcioni adresni pomak od 1, 2, ili 4 bajtaImmediate Opcionalna konstantna vrijednost od 1, 2 ili 4 bajta

Sve instrukcije ovog procesora opisane su u tabeli na strani 161. Slijedi objašnjenje tabele:

17.2. Operacioni kodovi, opis

Heksadekadni broj, na primjer 9F, predstavlja sam taj broj.Heksadekadni broj praćen oznakom +r, npr C8+r znači da se broj koji predstavlja registarski operand treba dodati tom broju.Npr., EDX je predstavljen brojem 2, pa će to generisati heksadekadni bajt CA.

Brojevi koji predstavljaju registarski operand 0 AL AX EAX ES ST0 MM0 xmmr0 CR0 DR0 1 CL CX ECX CS ST1 MM1 xmmr1 DR1 2 DL DX EDX SS ST2 MM2 xmmr2 CR2 DR2 3 BL BX EBX DS ST3 MM3 xmmr3 CR3 DR3 TR3 4 AH SP ESP FS ST4 MM4 xmmr4 CR4 TR4 5 CH BP EBP GS ST5 MM5 xmmr5 TR5 6 DH SI ESI ST6 MM6 xmmr6 DR6 TR6 7 BH DI EDI ST7 MM7 xmmr7 DR7 TR7

Sl. 17.2.1. Brojevi koji predstavljaju registarski operandJednocifreni broj iza kose crte (npr /3) znači da se taj broj smješta u rezervno polje ModRM bajta..

Simbol /r znači da broj koji predstavlja registarski operand se smješta u rezervno polje ModRM bajta.

Simboli ib, iw i id predstavljaju konstantnu vrijednost koja može biti bajt, riječ ili dupla riječ. Ovi podaci se smještajuu little endian formatu.

Simboli rb, rw i rd znače da je jedan od operanada konstantna vrijednost i da se razlika između te vrijednosti i adresekraja instrukcije treba kodirati kao bajt, riječ ili dupla riječ respektivno. Simbol r? predstavlja da se treba koristiti rw ili rdzavisno od toga da li se asembliranje vrši u 16-bitnom ili 32-bitnom režimu.

Simboli ow , od i o? znače da je jedan od operanada predstavljen apsolutnom adresom.

Simboli o16 i o32 znače da je veličina operanada 16 ili 32 bita. Intelovi procesori koriste prefiks 66 da promijenepodrazumijevanu veličinu operanada. Stoga o16 znači da će ta instrukcija imati prefiks 66 ako se asembliranje vrši u 32 bitnomrežimu a neće imati prefiks ako se asembliranje vrši u 16 bitnom režimu. Analogno, o32 znači da će ta instrukcija imatiprefiks 66 ako se asembliranje vrši u 16 bitnom režimu a neće imati prefiks ako se asembliranje vrši u 32 bitnom režimu.

Page 159: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

159Kodovi a16 i a32 slično kodovima o16 i o32 označavaju adresnu veličinu navedene forme instrukcije. Ako se ona ne

slaže sa podrazumijevanom veličinom, ubacuje se prefiks 67. Ovaj se prefiks ubacuje i kada nema kodova a16 i a32, anavedeni adresni način ne postoji u 16 bitnom odnosno 32 bitnom režimu (npr., ako u 32 bitnom režimu se prevodi instrukcijaMOV EAX,[BX] treba generisati prefiks 67, jer je [BX] šesnaestobitni adresni način.)

17.3. Operandi

U tabeli instrukcija operandi su označeni sljedećim kodovima:

reg8 8-bitni registar opšte namjenerg16 16-bitni registar opšte namjenerg32 32-bitni registar opšte namjenefpur Jedan od 8 FPU registarammxr Jedan od 8 MMX (64 bitnih) registarasegr Jedan od segmentnih registaraimmg Neki konstantni operandime8 8-bitni konstantni operandim16 16- bitni konstantni operandim32 32- bitni konstantni operandmemg Memorijska adresamem8 8-bitna memorijska adresamm16 16-bit memorijska adresa

mm32 32-bitna memorijska adresamm64 64-bitna memorijska adresamm80 80-bitna memorijska adresargm8 skraćenica za reg8/mem8rm16 skraćenica za rg16/mm16rm32 skraćenica za rg32/mm32rm64 skraćenica za mmxr/mm64abs8 apsolutna adresa 8 bitnih podatakaab16 apsolutna adresa 16 bitnih podatakaab32 apsolutna adresa 32 bitnih podatakacreg kontrolni registardreg Debug registartreg Task registar

Sl. 17.3.1. Tablica vrsta operanada

17.4. Kodiranje adrese: ModR/M i SIB bajtovi

Adresni operand je kodiran iz tri dijela (1) MOD/RM bajt, (2) opcionalni SIB bajt i (3) opcionalni bajt, riječ ili duplariječ pomaka.

ModR/M se sastoji od tri polja, mod polje u bitima 7..6, r/m polje u bitima 2..0 i rezervno polje u bitima 5..3-Rezervno polje nije relevantno za adresu koja se kodira.

R/M znači registar ili memorija, što znači da se može kodirati direktna referenca na registar umjesto memorijskogpristupa. To se radi postavljanjem mod polja na 3 i r/m polja na broj koji predstavlja registarski operand. U tom slučaju nemani SIB bajta ni pomaka.

U 16 bitnom režimu SIB bajt se nikada ne koristi. Mod predstavlja veličinu pomaka (0, 1, 2 bajta) ili 3 ako je upitanju registar. Polja 2..0 dopuštaju nekoliko kombinacija registara za adresiranje, pri čemu [bp] se mora kodirati kao [bp+0]

r/m | mod=00 mod=01 mod=10 mod=11 ----+-------------------------------------------- -------------------- 000 | [bx+si] [bx+si+disp8] [bx+si+disp16] al/ax/eax/mm0/xmmr0 001 | [bx+di] [bx+di+disp8] [bx+di+disp16] cl/cx/ecx/mm1/xmmr1 010 | [bp+si] [bp+si+disp8] [bp+si+disp16] dl/dx/edx/mm2/xmmr2 011 | [bp+di] [bp+di+disp8] [bp+di+disp16] bl/bx/ebx/mm3/xmmr3 100 | [si] [si+disp8] [si+disp16] ah/sp/esp/mm4/xmmr4 101 | [di] [di+disp8] [di+disp16] ch/bp/ebp/mm5/xmmr5 110 | [disp16] [bp+disp8] [bp+disp16] dh/si/esi/mm6/xmmr6 111 | [bx] [bx+disp8] [bx+disp16] bh/di/edi/mm7/xmmr7

Sl. 17.4.1. Kodiranje MOD/Rm bajta, 16 bitnoU 32 bitnom režimu mod polje predstavlja dužinu dijela pomaka, 0 znači da nema pomaka, 1 znači jedan bajt, 2

predstavlja 4 bajta. Ako se pomaku pridodaje samo jedan registar i on nije ESP, tada r/m polje sadrži vrijednost kojapredstavlja taj registar i nema polja SIB. Ako je r/m polje jednako 4 , postoji SIB polje. Također, [ebp] se mora kodirati kao[ebp+0].

r/m | mod=00 mod=01 mod=10 mod=11 ----+-------------------------------------------- --------------- 000 | [eax] [eax+disp8] [eax+disp32] al/ ax/eax/mm0/xmmr0 001 | [ecx] [ecx+disp8] [ecx+disp32] cl/ cx/ecx/mm1/xmmr1 010 | [edx] [edx+disp8] [edx+disp32] dl/ dx/edx/mm2/xmmr2 011 | [ebx] [ebx+disp8] [ebx+disp32] bl/ bx/ebx/mm3/xmmr3 100 | SIB SIB+disp8 SIB+disp32 ah/ sp/esp/mm4/xmmr4 101 | [disp32] [ebp+disp8] [ebp+disp32] ch/ bp/ebp/mm5/xmmr5 110 | [esi] [esi+disp8] [esi+disp32] dh/ si/esi/mm6/xmmr6 111 | [edi] [edi+disp8] [edi+disp32] bh/ di/edi/mm7/xmmr7

Sl. 17.4.2. Kodiranje ModRm , 32 bitno

Page 160: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

160SIB bajt ima tri polja: Faktor skaliranja u bitima 7..6 koji predstavljaju 1, 2, 4 ili 8, indeksni registar u bitima 5..3 i

bazni registar u bitima 2..0. Ideja je da se generiše [BASE + SCALE*INDEX], koji se onda dodaju eventualnom pomakunavedenom u ModR/M bajtu. Na primjer, kod D3 (11010011) ima skalu 11 (znači 8), indeksni registar 010 (znači EDX) ibazni registar 011 (znači EBX) pa se kodira kao [ebx+edx*8].

Ipak, ESP se ne može koristiti kao indeksni registar, pa ako indeksno polje sadrži 4, to znači da nema indeksnogregistra. Takođe, ako bazno polje sadrži 5, a mod biti su 00, adresa nije [ebp+scale*index] nego [scale*index+disp32] (nemabaznog registra).

Primjeri:

ecx 11xxx001 [ecx] 00xxx001 [ecx+12345678H] 10xxx001 78 56 34 12 [ecx+esi*2] 00xxx100 71 [ecx+esi*2+12345678H] 10xxx100 71 78 56 34 1 2 [esi*2] 00xxx100 75 [esi*2+12345678H] 10xxx100 75 78 56 34 1 2 [12345678H] 00xxx101 78 56 34 12 [ebp] 01xxx101 00 [ebp+12345678H] 10xxx101 78 56 34 12 [ebp+eax*4] 01xxx100 85 00 [ebp+eax*4+12345678H] 10xxx100 85 78 56 34 1 2 [esp] 00xxx100 24 [esp+12345678H] 10xxx100 24 78 56 34 1 2

17.5. Primjeri kodiranja kompletnih instrukcijaMOV ECX,[EDX+150h]

Prvi operand je 32bitni registar opšte namjene, a drugi 32 bitna memorijska lokacija. U tablici se nalazi

MOV rg32,rm32 o32 8B /rAko je režim rada 32-bitni (tj. generiše se kod za 32 bitne operativne sisteme), o32 nema značenja. Operacioni kod

instrukcije je 8B. [EDX+150h] spada u kategoriju [EDX+Disp32] koja u polju r/m ima vrijednost 010 binarno, a u polju modvrijednost 10 binarno. Ovaj adresni režim ne zahtijeva SIB bajt, ali ima pomak. Rezervno polje ModRM bajta je broj registraECX koji iznosi 1, odnosno binarno 001. Stoga je ModRM bajt 10 001 010, što u heksadekadnom sistemu iznosi 8A. Pomaknapisan 32 bitno iznosi 00000150, što napisano little endian formatom predstavlja 50 01 00 00. Dakle, ova instrukcija se kodirakao

8B 8A 50 01 00 00

U 16 bitnom režimu rada vidimo da je adresa 32 bitna, pa je neophodan prefiks 67. Takođe, o32 znači da treba dodatii prefiks 66, pa se ova instrukcija piše kao

66 67 8B 8A 50 01 00 00

XOR BX,1500hPrvi operand je 16 bitni registar, drugi operand 16 bitna konstanta. U tabeli je takav slučaj naveden kao

XOR rm16,im16 o16 81 /6 iwU šesnaestobitnom režimu nije potreban prefiks, a u 32 bitnom simbol o16 predstavlja da je tu potreban prefiks 66.

Pošto se nigdje ne spominje adresa, nema prefiksa 67. Operacioni kod je 81. Pošto je operand tipa registar (neposrednavrijednost nije u tabeli ModRm), mod=11, r/m=011. Oznaka /6 znači da se u rezervno polje upisuje vrijednost 6, tj. 110. Stogaje bajt ModRm jednak 11 110 011, ili heksadekadno F3. Pomak 1500h u little endian se piše kao 00 15. Prema tome, u 16bitnom režimu ova instrukcija se kodira kao 81 F3 15 00 ,a u 32 bitnom kao 66 81 F3 15 00.

Page 161: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

161AAA 37AAD D5 0AAAM D4 0AAAS 3FADC AL,ime8 14 ibADC AX,im16 o16 15 iwADC EAX,im32 o32 15 idADC reg8,rgm8 12 /rADC rgm8,ime8 80 /2 ibADC rgm8,reg8 10 /rADC rg16,rm16 o16 13 /rADC rg32,rm32 o32 13 /rADC rm16,ime8 o16 83 /2 ibADC rm16,im16 o16 81 /2 iwADC rm16,rg16 o16 11 /rADC rm32,ime8 o32 83 /2 ibADC rm32,im32 o32 81 /2 idADC rm32,rg32 o32 11 /rADD AL,ime8 04 ibADD AX,im16 o16 05 iwADD EAX,im32 o32 05 idADD reg8,rgm8 02 /rADD rgm8,ime8 80 /0 ibADD rgm8,reg8 00 /rADD rg16,rm16 o16 03 /rADD rg32,rm32 o32 03 /rADD rm16,ime8 o16 83 /0 ibADD rm16,im16 o16 81 /0 iwADD rm16,rg16 o16 01 /rADD rm32,ime8 o32 83 /0 ibADD rm32,im32 o32 81 /0 idADD rm32,rg32 o32 01 /rAND AL,ime8 24 ibAND AX,im16 o16 25 iwAND EAX,im32 o32 25 idAND reg8,rgm8 22 /rAND rgm8,ime8 80 /4 ibAND rgm8,reg8 20 /rAND rg16,rm16 o16 23 /rAND rg32,rm32 o32 23 /rAND rm16,ime8 o16 83 /4 ibAND rm16,im16 o16 81 /4 iwAND rm16,rg16 o16 21 /rAND rm32,ime8 o32 83 /4 ibAND rm32,im32 o32 81 /4 idAND rm32,rg32 o32 21 /rARPL rm16,rg16 63 /rBOUND rg16,mm16:16 o16 62 /rBOUND rg32,mm32:32 o32 62 /rBSF rg16,rm16 o16 0F BC /rBSF rg32,rm32 o32 0F BC /rBSR rg16,rm16 o16 0F BD /rBSR rg32,rm32 o32 0F BD /rBSWAP rg32 o32 0F C8+rgBTC rm16,ime8 o16 0F BA /7 ibBTC rm16,rg16 o16 0F BB /rBTC rm32,ime8 o32 0F BA /7 ibBTC rm32,rg32 o32 0F BB /rBTR rm16,ime8 o16 0F BA /6 ibBTR rm16,rg16 o16 0F B3 /rBTR rm32,ime8 o32 0F BA /6 ibBTR rm32,rg32 o32 0F B3 /rBTS rm16,immg o16 0F BA /5 ibBTS rm16,rg16 o16 0F AB /rBTS rm32,immg o32 0F BA /5 ibBTS rm32,rg32 o32 0F AB /rBT rm16,ime8 o16 0F BA /4 ibBT rm16,rg16 o16 0F A3 /rBT rm32,ime8 o32 0F BA /4 ibBT rm32,rg32 o32 0F A3 /rCALL_FAR mm16 o16 FF /3CALL_FAR mm32 o32 FF /3CALL immg E8 r?CALL immg:im16 o16 9A iw iwCALL immg:im32 o32 9A id iwCALL rm16 o16 FF /2CALL rm32 o32 FF /2CBW o16 98CDQ o32 99CLC F8CLD FCCLI FACLTS 0F 06CMC F5CMOVO rg16,rm16 o16 0F 40 /rCMOVO rg32,rm32 o32 0F 40 /rCMOVNO rg16,rm16 o16 0F 41 /rCMOVNO rg32,rm32 o32 0F 41 /rCMOVC rg16,rm16 o16 0F 42 /rCMOVC rg32,rm32 o32 0F 42 /rCMOVB rg16,rm16 o16 0F 42 /rCMOVB rg32,rm32 o32 0F 42 /rCMOVNC rg16,rm16 o16 0F 43 /rCMOVNC rg32,rm32 o32 0F 43 /rCMOVAE rg16,rm16 o16 0F 43 /rCMOVAE rg32,rm32 o32 0F 43 /rCMOVE rg16,rm16 o16 0F 44 /rCMOVE rg32,rm32 o32 0F 44 /rCMOVZ rg16,rm16 o16 0F 44 /rCMOVZ rg32,rm32 o32 0F 44 /rCMOVNE rg16,rm16 o16 0F 45 /rCMOVNE rg32,rm32 o32 0F 45 /rCMOVNZ rg16,rm16 o16 0F 45 /rCMOVNZ rg32,rm32 o32 0F 45 /rCMOVBE rg16,rm16 o16 0F 46 /rCMOVBE rg32,rm32 o32 0F 46 /rCMOVA rg16,rm16 o16 0F 47 /rCMOVA rg32,rm32 o32 0F 47 /rCMOVS rg16,rm16 o16 0F 48 /rCMOVS rg32,rm32 o32 0F 48 /r

CMOVNS rg16,rm16 o16 0F 49 /rCMOVNS rg32,rm32 o32 0F 49 /rCMOVP rg16,rm16 o16 0F 4A /rCMOVP rg32,rm32 o32 0F 4A /rCMOVPE rg16,rm16 o16 0F 4A /rCMOVPE rg32,rm32 o32 0F 4A /rCMOVNP rg16,rm16 o16 0F 4B /rCMOVNP rg32,rm32 o32 0F 4B /rCMOVPO rg16,rm16 o16 0F 4B /rCMOVPO rg32,rm32 o32 0F 4B /rCMOVL rg16,rm16 o16 0F 4C /rCMOVL rg32,rm32 o32 0F 4C /rCMOVGE rg16,rm16 o16 0F 4D /rCMOVGE rg32,rm32 o32 0F 4D /rCMOVNL rg16,rm16 o16 0F 4D /rCMOVNL rg32,rm32 o32 0F 4D /rCMOVLE rg16,rm16 o16 0F 4E /rCMOVLE rg32,rm32 o32 0F 4E /rCMOVG rg16,rm16 o16 0F 4F /rCMOVG rg32,rm32 o32 0F 4F /rCMPSB A6CMPSD o32 A7CMPSW o16 A7CMPXCHG8B mm64 0F C7 /1CMPXCHG rgm8,reg8 0F B0 /rCMPXCHG rm16,rg16 o16 0F B1 /rCMPXCHG rm32,rg32 o32 0F B1 /rCMP AL,ime8 3C ibCMP AX,im16 o16 3D iwCMP EAX,im32 o32 3D idCMP reg8,rgm8 3A /rCMP rgm8,ime8 80 /0 ibCMP rgm8,reg8 38 /rCMP rg16,rm16 o16 3B /rCMP rg32,rm32 o32 3B /rCMP rm16,ime8 o16 83 /0 ibCMP rm16,im16 o16 81 /0 iwCMP rm16,rg16 o16 39 /rCMP rm32,ime8 o32 83 /0 ibCMP rm32,im32 o32 81 /0 idCMP rm32,rg32 o32 39 /rCPUID 0F A2CWDE o32 98CWD o16 99DAA 27DAS 2FDEC rgm8 FE /1DEC rg16 o16 48+rgDEC rg32 o32 48+rgDEC rm16 o16 FF /1DEC rm32 o32 FF /1DIV rgm8 F6 /6DIV rm16 o16 F7 /6DIV rm32 o32 F7 /6EMMS 0F 77ENTER immg,immg C8 iw ibFABS D9 E1FADDP fpur DE C0+rgFADDP fpur,ST0 DE C0+rgFADD DE C1FADD fpur D8 C0+rgFADD fpur,ST0 DC C0+rgFADD mm32 D8 /0FADD mm64 DC /0FADD ST0,fpur D8 C0+rgFBLD mm80 DF /4FBSTP mm80 DF /6FCHS D9 E0FCLEX 9B DB E2FCMOVBE fpur DA D0+rgFCMOVBE ST0,fpur DA D0+rgFCMOVB fpur DA C0+rgFCMOVB ST0,fpur DA C0+rgFCMOVE fpur DA C8+rgFCMOVE ST0,fpur DA C8+rgFCMOVNBE fpur DB D0+rgFCMOVNBE ST0,fpur DB D0+rgFCMOVNB fpur DB C0+rgFCMOVNB ST0,fpur DB C0+rgFCMOVNE fpur DB C8+rgFCMOVNE ST0,fpur DB C8+rgFCMOVNU fpur DB D8+rgFCMOVNU ST0,fpur DB D8+rgFCMOVU fpur DA D8+rgFCMOVU ST0,fpur DA D8+rgFCOMIP fpur DF F0+rgFCOMIP ST0,fpur DF F0+rgFCOMI fpur DB F0+rgFCOMI ST0,fpur DB F0+rgFCOMPP DE D9FCOMP fpur D8 D8+rgFCOMP mm32 D8 /3FCOMP mm64 DC /3FCOMP ST0,fpur D8 D8+rgFCOM fpur D8 D0+rgFCOM mm32 D8 /2FCOM mm64 DC /2FCOM ST0,fpur D8 D0+rgFCOS D9 FFFDECSTP D9 F6FDISI 9B DB E1FDIVP fpur DE F8+rgFDIVP fpur,ST0 DE F8+rgFDIVRP fpur DE F0+rgFDIVRP fpur,ST0 DE F0+rgFDIVR DE F1FDIVR fpur D8 F8+rgFDIVR fpur,ST0 DC F0+rgFDIVR mm32 D8 /0FDIVR mm64 DC /0

FDIVR ST0,fpur D8 F8+rgFDIV fpur D8 F0+rgFDIV fpur,ST0 DC F8+rgFDIV mm32 D8 /6FDIV mm64 DC /6FDIV ST0,fpur D8 F0+rgFENI 9B DB E0FFREEP fpur DF C0+rgFFREE fpur DD C0+rgFIADD mm16 DE /0FIADD mm32 DA /0FICOMP mm16 DE /3FICOMP mm32 DA /3FICOM mm16 DE /2FICOM mm32 DA /2FIDIVR mm16 DE /0FIDIVR mm32 DA /0FIDIV mm16 DE /6FIDIV mm32 DA /6FILD mm16 DF /0FILD mm32 DB /0FILD mm64 DF /5FIMUL mm16 DE /1FIMUL mm32 DA /1FINCSTP D9 F7FINIT 9B DB E3FISTP mm16 DF /3FISTP mm32 DB /3FISTP mm64 DF /0FIST mm16 DF /2FIST mm32 DB /2FISUBR mm16 DE /5FISUBR mm32 DA /5FISUB mm16 DE /4FISUB mm32 DA /4FLDCW mm16 D9 /5FLDENV memg D9 /4FLDLG2 D9 ECFLDLN2 D9 EDFLDL2E D9 EAFLDL2T D9 E9FLDPI D9 EBFLDZ D9 EEFLD1 D9 E8FLD fpur D9 C0+rgFLD mm32 D9 /0FLD mm64 DD /0FLD mm80 DB /5FMULP fpur DE C8+rgFMULP fpur,ST0 DE C8+rgFMUL DE C9FMUL fpur D8 C8+rgFMUL fpur,ST0 DC C8+rgFMUL mm32 D8 /1FMUL mm64 DC /1FMUL ST0,fpur D8 C8+rgFNCLEX DB E2FNDISI DB E1FNENI DB E0FNINIT DB E3FNOP D9 D0FNSAVE memg DD /6FNSTCW mm16 D9 /0FNSTENV memg D9 /6FNSTSW AX DF E0FNSTSW mm16 DD /0FPATAN D9 F3FPREM1 D9 F5FPREM D9 F8FPTAN D9 F2FRNDINT D9 FCFRSTOR memg DD /4FSAVE memg 9B DD /6FSCALE D9 FDFSETPM DB E4FSINCOS D9 FBFSIN D9 FEFSQRT D9 FAFSTCW mm16 9B D9 /0FSTENV memg 9B D9 /6FSTP fpur DD D8+rgFSTP mm32 D9 /3FSTP mm64 DD /3FSTP mm80 DB /0FSTSW AX 9B DF E0FSTSW mm16 9B DD /0FST fpur DD D0+rgFST mm32 D9 /2FST mm64 DD /2FSUBP fpur DE E8+rgFSUBP fpur,ST0 DE E8+rgFSUBRP fpur DE E0+rgFSUBRP fpur,ST0 DE E0+rgFSUBR DE E1FSUBR fpur D8 E8+rgFSUBR fpur,ST0 DC E0+rgFSUBR mm32 D8 /5FSUBR mm64 DC /5FSUBR ST0,fpur D8 E8+rgFSUB fpur D8 E0+rgFSUB fpur,ST0 DC E8+rgFSUB mm32 D8 /4FSUB mm64 DC /4FSUB ST0,fpur D8 E0+rgFTST D9 E4FUCOMIP fpur DF E8+rgFUCOMIP ST0,fpur DF E8+rgFUCOMI fpur DB E8+rgFUCOMI ST0,fpur DB E8+rgFUCOMPP DA E9

FUCOMP fpur DD E8+rgFUCOMP ST0,fpur DD E8+rgFUCOM fpur DD E0+rgFUCOM ST0,fpur DD E0+rgFWAIT 9BFXAM D9 E5FXCH fpur D9 C8+rgFXCH fpur,ST0 D9 C8+rgFXCH ST0,fpur D9 C8+rgFXCH D9 C9FXTRACT D9 F4FYL2XP1 D9 F9FYL2X D9 F1F2XM1 D9 F0HLT F4IBTS rm16,rg16 o16 0F A7 /rIBTS rm32,rg32 o32 0F A7 /rICEBP F1IDIV rgm8 F6 /7IDIV rm16 o16 F7 /7IDIV rm32 o32 F7 /7IMUL rgm8 F6 /5IMUL rg16,ime8 o16 6B /r ibIMUL rg16,im16 o16 69 /r iwIMUL rg16,rm16 o16 0F AF /rIMUL rg16,rm16,ime8 o16 6B /r ibIMUL rg16,rm16,im16 o16 69 /r iwIMUL rg32,ime8 o32 6B /r ibIMUL rg32,im32 o32 69 /r idIMUL rg32,rm32 o32 0F AF /rIMUL rg32,rm32,ime8 o32 6B /r ibIMUL rg32,rm32,im32 o32 69 /r idIMUL rm16 o16 F7 /5IMUL rm32 o32 F7 /5INC rgm8 FE /0INC rg16 o16 40+rgINC rg32 o32 40+rgINC rm16 o16 FF /0INC rm32 o32 FF /0INSB 6CINSD o32 6DINSW o16 6DINTO CEINT1 F1INT3 CCINT ime8 CD ibINVD 0F 08INVLPG memg 0F 01 /0IN AL,DX ECIN AL,ime8 E4 ibIN AX,DX o16 EDIN AX,ime8 o16 E5 ibIN EAX,DX o32 EDIN EAX,ime8 o32 E5 ibIRETD o32 CFIRETW o16 CFIRET CFJO immg 70 rbJO_NEAR immg 0F 80 r?JNO immg 71 rbJNO_NEAR immg 0F 81 r?JC immg 72 rbJC_NEAR immg 0F 82 r?JB immg 72 rbJB_NEAR immg 0F 82 r?JNAE immg 72 rbJNAE_NEAR immg 0F 82 r?JNC immg 73 rbJNC_NEAR immg 0F 83 r?JNB immg 73 rbJNB_NEAR immg 0F 83 r?JAE immg 73 rbJAE_NEAR immg 0F 83 r?JE immg 74 rbJE_NEAR immg 0F 84 r?JZ immg 74 rbJZ_NEAR immg 0F 84 r?JNE immg 75 rbJNE_NEAR immg 0F 85 r?JNZ immg 75 rbJNZ_NEAR immg 0F 85 r?JBE immg 76 rbJBE_NEAR immg 0F 86 r?JNA immg 76 rbJNA_NEAR immg 0F 86 r?JA immg 77 rbJA_NEAR immg 0F 87 r?JNBE immg 77 rbJNBE_NEAR immg 0F 87 r?JS immg 78 rbJS_NEAR immg 0F 88 r?JNS immg 79 rbJNS_NEAR immg 0F 89 r?JP immg 7A rbJP_NEAR immg 0F 8A r?JPE immg 7A rbJPE_NEAR immg 0F 8A r?JNP immg 7B rbJNP_NEAR immg 0F 8B r?JPO immg 7B rbJPO_NEAR immg 0F 8B r?JL immg 7C rbJL_NEAR immg 0F 8C r?JNGE immg 7C rbJNGE_NEAR immg 0F 8C r?JGE immg 7D rbJGE_NEAR immg 0F 8D r?JNL immg 7D rbJNL_NEAR immg 0F 8D r?JLE immg 7E rb

Page 162: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

162JLE_NEAR immg 0F 8E r?JNG immg 7E rbJNG_NEAR immg 0F 8E r?JG immg 7F rbJG_NEAR immg 0F 8F r?JNLE immg 7F rbJNLE_NEAR immg 0F 8F r?JCXZ immg o16 E3 rbJECXZ immg o32 E3 rbJMP_FAR memg o16 FF /5JMP_FAR memg o32 FF /5JMP immg E9 r?JMP immg:im16 o16 EA iw iwJMP immg:im32 o32 EA id iwJMP rm16 o16 FF /4JMP rm32 o32 FF /4JMP_SHORT immg EB rbLAHF 9FLAR rg16,rm16 o16 0F 02 /rLAR rg32,rm32 o32 0F 02 /rLDS rg16,memg o16 C5 /rLDS rg32,memg o32 C5 /rLEAVE C9LEA rg16,memg o16 8D /rLEA rg32,memg o32 8D /rLES rg16,memg o16 C4 /rLES rg32,memg o32 C4 /rLFS rg16,memg o16 0F B4 /rLFS rg32,memg o32 0F B4 /rLGDT memg 0F 01 /2LGS rg16,memg o16 0F B5 /rLGS rg32,memg o32 0F B5 /rLIDT memg 0F 01 /3LLDT rm16 0F 00 /2LMSW rm16 0F 01 /6LOADALL286 0F 05LOADALL 0F 07LODSB ACLODSD o32 ADLODSW o16 ADLOOPE immg E1 rbLOOPE immg,CX a16 E1 rbLOOPE immg,ECX a32 E1 rbLOOPNE immg E0 rbLOOPNE immg,CX a16 E0 rbLOOPNE immg,ECX a32 E0 rbLOOPNZ immg E0 rbLOOPNZ immg,CX a16 E0 rbLOOPNZ immg,ECX a32 E0 rbLOOPZ immg E1 rbLOOPZ immg,CX a16 E1 rbLOOPZ immg,ECX a32 E1 rbLOOP immg E2 rbLOOP immg,CX a16 E2 rbLOOP immg,ECX a32 E2 rbLSL rg16,rm16 o16 0F 03 /rLSL rg32,rm32 o32 0F 03 /rLSS rg16,memg o16 0F B2 /rLSS rg32,memg o32 0F B2 /rLTR rm16 0F 00 /3MOVD mmxr,rm32 0F 6E /rMOVD rm32,mmxr 0F 7E /rMOVQ mmxr,rm64 0F 6F /rMOVQ rm64,mmxr 0F 7F /rMOVSB A4MOVSD o32 A5MOVSW o16 A5MOVSX rg16,rgm8 o16 0F BE /rMOVSX rg32,rgm8 o32 0F BE /rMOVSX rg32,rm16 o32 0F BF /rMOVZX rg16,rgm8 o16 0F B6 /rMOVZX rg32,rgm8 o32 0F B6 /rMOVZX rg32,rm16 o32 0F B7 /rMOV abs8,AL A2 o?MOV ab16,AX o16 A3 o?MOV ab32,EAX o32 A3 o?MOV AL,abs8 A0 o?MOV AX,ab16 o16 A1 o?MOV creg,rg32 0F 22 /rMOV dreg,rg32 0F 23 /rMOV EAX,ab32 o32 A1 o?MOV reg8,ime8 B0+rg ibMOV reg8,rgm8 8A /rMOV rgm8,ime8 C6 /0 ibMOV rgm8,reg8 88 /rMOV rg16,im16 o16 B8+rg iwMOV rg16,rm16 o16 8B /rMOV rg32,creg 0F 20 /rMOV rg32,dreg 0F 21 /rMOV rg32,im32 o32 B8+rg idMOV rg32,rm32 o32 8B /rMOV rg32,treg 0F 24 /rMOV rm16,im16 o16 C7 /0 iwMOV rm16,rg16 o16 89 /rMOV rm16,segr o16 8C /rMOV rm32,im32 o32 C7 /0 idMOV rm32,rg32 o32 89 /rMOV rm32,segr o32 8C /rMOV segr,rm16 o16 8E /rMOV segr,rm32 o32 8E /rMOV treg,rg32 0F 26 /rMUL rgm8 F6 /4MUL rm16 o16 F7 /4MUL rm32 o32 F7 /4NEG rgm8 F6 /3NEG rm16 o16 F7 /3NEG rm32 o32 F7 /3NOP 90NOT rgm8 F6 /2NOT rm16 o16 F7 /2

NOT rm32 o32 F7 /2OR AL,ime8 0C ibOR AX,im16 o16 0D iwOR EAX,im32 o32 0D idOR reg8,rgm8 0A /rOR rgm8,ime8 80 /1 ibOR rgm8,reg8 08 /rOR rg16,rm16 o16 0B /rOR rg32,rm32 o32 0B /rOR rm16,ime8 o16 83 /1 ibOR rm16,im16 o16 81 /1 iwOR rm16,rg16 o16 09 /rOR rm32,ime8 o32 83 /1 ibOR rm32,im32 o32 81 /1 idOR rm32,rg32 o32 09 /rOUTSB 6EOUTSD o32 6FOUTSW o16 6FOUT DX,AL EEOUT DX,AX o16 EFOUT DX,EAX o32 EFOUT ime8,AL E6 ibOUT ime8,AX o16 E7 ibOUT ime8,EAX o32 E7 ibPACKSSDW mmxr,rm64 0F 6B /rPACKSSWB mmxr,rm64 0F 63 /rPACKUSWB mmxr,rm64 0F 67 /rPADDB mmxr,rm64 0F FC /rPADDD mmxr,rm64 0F FE /rPADDQ mmxr,rm64 0F D4 /rPADDSB mmxr,rm64 0F EC /rPADDSW mmxr,rm64 0F ED /rPADDUSB mmxr,rm64 0F DC /rPADDUSW mmxr,rm64 0F DD /rPADDW mmxr,rm64 0F FD /rPANDN mmxr,rm64 0F DF /rPAND mmxr,rm64 0F DB /rPCMPEQB mmxr,rm64 0F 74 /rPCMPEQD mmxr,rm64 0F 76 /rPCMPEQW mmxr,rm64 0F 75 /rPCMPGTB mmxr,rm64 0F 64 /rPCMPGTD mmxr,rm64 0F 66 /rPCMPGTW mmxr,rm64 0F 65 /rPMADDWD mmxr,rm64 0F F5 /rPMULHW mmxr,rm64 0F E5 /rPMULLW mmxr,rm64 0F D5 /rPOPAD o32 61POPAW o16 61POPA 61POPFD o32 9DPOPFW o16 9DPOPF 9DPOP DS 1FPOP ES 07POP FS 0F A1POP GS 0F A9POP rg16 o16 58+rgPOP rg32 o32 58+rgPOP rm16 o16 8F /0POP rm32 o32 8F /0POP SS 17POR mmxr,rm64 0F EB /rPSLLD mmxr,ime8 0F 72 /6 ibPSLLD mmxr,rm64 0F F2 /rPSLLQ mmxr,ime8 0F 73 /6 ibPSLLQ mmxr,rm64 0F F3 /rPSLLW mmxr,ime8 0F 71 /6 ibPSLLW mmxr,rm64 0F F1 /rPSRAD mmxr,ime8 0F 72 /4 ibPSRAD mmxr,rm64 0F E2 /rPSRAW mmxr,ime8 0F 71 /4 ibPSRAW mmxr,rm64 0F E1 /rPSRLD mmxr,ime8 0F 72 /2 ibPSRLD mmxr,rm64 0F D2 /rPSRLQ mmxr,ime8 0F 73 /2 ibPSRLQ mmxr,rm64 0F D3 /rPSRLW mmxr,ime8 0F 71 /2 ibPSRLW mmxr,rm64 0F D1 /rPSUBB mmxr,rm64 0F F8 /rPSUBD mmxr,rm64 0F FA /rPSUBSB mmxr,rm64 0F E8 /rPSUBSW mmxr,rm64 0F E9 /rPSUBUSB mmxr,rm64 0F D8 /rPSUBUSW mmxr,rm64 0F D9 /rPSUBW mmxr,rm64 0F F9 /rPUNPCKHBW mmxr,rm64 0F 68 /rPUNPCKHDQ mmxr,rm64 0F 6A /rPUNPCKHWD mmxr,rm64 0F 69 /rPUNPCKLBW mmxr,rm64 0F 60 /rPUNPCKLDQ mmxr,rm64 0F 62 /rPUNPCKLWD mmxr,rm64 0F 61 /rPUSHAD o32 60PUSHAW o16 60PUSHA 60PUSHFD o32 9CPUSHFW o16 9CPUSHF 9CPUSH CS 0EPUSH DS 1EPUSH ES 06PUSH FS 0F A0PUSH GS 0F A8PUSH ime8 6A ibPUSH im16 o16 68 iwPUSH im32 o32 68 idPUSH rg16 o16 50+rgPUSH rg32 o32 50+rgPUSH rm16 o16 FF /6PUSH rm32 o32 FF /6PUSH SS 16

PXOR mmxr,rm64 0F EF /rRCL rgm8,CL D2 /2RCL rgm8,ime8 C0 /2 ibRCL rgm8,1 D0 /2RCL rm16,CL o16 D3 /2RCL rm16,ime8 o16 C1 /2 ibRCL rm16,1 o16 D1 /2RCL rm32,CL o32 D3 /2RCL rm32,ime8 o32 C1 /2 ibRCL rm32,1 o32 D1 /2RCR rgm8,CL D2 /3RCR rgm8,ime8 C0 /3 ibRCR rgm8,1 D0 /3RCR rm16,CL o16 D3 /3RCR rm16,ime8 o16 C1 /3 ibRCR rm16,1 o16 D1 /3RCR rm32,CL o32 D3 /3RCR rm32,ime8 o32 C1 /3 ibRCR rm32,1 o32 D1 /3RDMSR 0F 32RDPMC 0F 33RDTSC 0F 31RETF im16 CA iwRETF CBRETN im16 C2 iwRETN C3RET im16 C2 iwRET C3ROL rgm8,CL D2 /0ROL rgm8,ime8 C0 /0 ibROL rgm8,1 D0 /0ROL rm16,CL o16 D3 /0ROL rm16,ime8 o16 C1 /0 ibROL rm16,1 o16 D1 /0ROL rm32,CL o32 D3 /0ROL rm32,ime8 o32 C1 /0 ibROL rm32,1 o32 D1 /0ROR rgm8,CL D2 /1ROR rgm8,ime8 C0 /1 ibROR rgm8,1 D0 /1ROR rm16,CL o16 D3 /1ROR rm16,ime8 o16 C1 /1 ibROR rm16,1 o16 D1 /1ROR rm32,CL o32 D3 /1ROR rm32,ime8 o32 C1 /1 ibROR rm32,1 o32 D1 /1RSM 0F AASAHF 9ESALC D6SAL rgm8,CL D2 /4SAL rgm8,ime8 C0 /4 ibSAL rgm8,1 D0 /4SAL rm16,CL o16 D3 /4SAL rm16,ime8 o16 C1 /4 ibSAL rm16,1 o16 D1 /4SAL rm32,CL o32 D3 /4SAL rm32,ime8 o32 C1 /4 ibSAL rm32,1 o32 D1 /4SAR rgm8,CL D2 /0SAR rgm8,ime8 C0 /0 ibSAR rgm8,1 D0 /0SAR rm16,CL o16 D3 /0SAR rm16,ime8 o16 C1 /0 ibSAR rm16,1 o16 D1 /0SAR rm32,CL o32 D3 /0SAR rm32,ime8 o32 C1 /0 ibSAR rm32,1 o32 D1 /0SBB AL,ime8 1C ibSBB AX,im16 o16 1D iwSBB EAX,im32 o32 1D idSBB reg8,rgm8 1A /rSBB rgm8,ime8 80 /3 ibSBB rgm8,reg8 18 /rSBB rg16,rm16 o16 1B /rSBB rg32,rm32 o32 1B /rSBB rm16,ime8 o16 83 /3 ibSBB rm16,im16 o16 81 /3 iwSBB rm16,rg16 o16 19 /rSBB rm32,ime8 o32 83 /3 ibSBB rm32,im32 o32 81 /3 idSBB rm32,rg32 o32 19 /rSCASB AESCASD o32 AFSCASW o16 AFSETO rgm8 0F 90 /2SETNO rgm8 0F 91 /2SETC rgm8 0F 92 /2SETB rgm8 0F 92 /2SETNAE rgm8 0F 92 /2SETNC rgm8 0F 93 /2SETNB rgm8 0F 93 /2SETAE rgm8 0F 93 /2SETE rgm8 0F 94 /2SETZ rgm8 0F 94 /2SETNE rgm8 0F 95 /2SETNZ rgm8 0F 95 /2SETBE rgm8 0F 96 /2SETNA rgm8 0F 96 /2SETA rgm8 0F 97 /2SETNBE rgm8 0F 97 /2SETS rgm8 0F 98 /2SETNS rgm8 0F 99 /2SETP rgm8 0F 9A /2SETPE rgm8 0F 9A /2SETNP rgm8 0F 9B /2SETPO rgm8 0F 9B /2SETL rgm8 0F 9C /2SETNGE rgm8 0F 9C /2SETGE rgm8 0F 9D /2SETNL rgm8 0F 9D /2

SETLE rgm8 0F 9E /2SETNG rgm8 0F 9E /2SETG rgm8 0F 9F /2SETNLE rgm8 0F 9F /2SGDT memg 0F 01 /0SHLD rm16,rg16,CL o16 0F A5 /rSHLD rm16,rg16,ime8 o16 0F A4 /r ibSHLD rm32,rg32,CL o32 0F A5 /rSHLD rm32,rg32,ime8 o32 0F A4 /r ibSHL rgm8,CL D2 /4SHL rgm8,ime8 C0 /4 ibSHL rgm8,1 D0 /4SHL rm16,CL o16 D3 /4SHL rm16,ime8 o16 C1 /4 ibSHL rm16,1 o16 D1 /4SHL rm32,CL o32 D3 /4SHL rm32,ime8 o32 C1 /4 ibSHL rm32,1 o32 D1 /4SHRD rm16,rg16,CL o16 0F AD /rSHRD rm16,rg16,ime8 o16 0F AC /r ibSHRD rm32,rg32,CL o32 0F AD /rSHRD rm32,rg32,ime8 o32 0F AC /r ibSHR rgm8,CL D2 /5SHR rgm8,ime8 C0 /5 ibSHR rgm8,1 D0 /5SHR rm16,CL o16 D3 /5SHR rm16,ime8 o16 C1 /5 ibSHR rm16,1 o16 D1 /5SHR rm32,CL o32 D3 /5SHR rm32,ime8 o32 C1 /5 ibSHR rm32,1 o32 D1 /5SIDT memg 0F 01 /1SLDT rm16 0F 00 /0SMI F1SMSW rm16 0F 01 /4STC F9STD FDSTI FBSTOSB AASTOSD o32 ABSTOSW o16 ABSTR rm16 0F 00 /1SUB AL,ime8 2C ibSUB AX,im16 o16 2D iwSUB EAX,im32 o32 2D idSUB reg8,rgm8 2A /rSUB rgm8,ime8 80 /5 ibSUB rgm8,reg8 28 /rSUB rg16,rm16 o16 2B /rSUB rg32,rm32 o32 2B /rSUB rm16,ime8 o16 83 /5 ibSUB rm16,im16 o16 81 /5 iwSUB rm16,rg16 o16 29 /rSUB rm32,ime8 o32 83 /5 ibSUB rm32,im32 o32 81 /5 idSUB rm32,rg32 o32 29 /rSYSENTER 0F 34SYSEXIT 0F 36TEST AL,ime8 A8 ibTEST AX,im16 o16 A9 iwTEST EAX,im32 o32 A9 idTEST rgm8,ime8 F6 /7 ibTEST rgm8,reg8 84 /rTEST rm16,im16 o16 F7 /7 iwTEST rm16,rg16 o16 85 /rTEST rm32,im32 o32 F7 /7 idTEST rm32,rg32 o32 85 /rUD1 0F B9UD2 0F 0BUMOV reg8,rgm8 0F 12 /rUMOV rgm8,reg8 0F 10 /rUMOV rg16,rm16 o16 0F 13 /rUMOV rg32,rm32 o32 0F 13 /rUMOV rm16,rg16 o16 0F 11 /rUMOV rm32,rg32 o32 0F 11 /rVERR rm16 0F 00 /4VERW rm16 0F 00 /5WAIT 9BWBINVD 0F 09WRMSR 0F 30XADD rgm8,reg8 0F C0 /rXADD rm16,rg16 o16 0F C1 /rXADD rm32,rg32 o32 0F C1 /rXBTS rg16,rm16 o16 0F A6 /rXBTS rg32,rm32 o32 0F A6 /rXCHG AX,rg16 o16 90+rgXCHG EAX,rg32 o32 90+rgXCHG reg8,rgm8 86 /rXCHG rgm8,reg8 86 /rXCHG rg16,AX o16 90+rgXCHG rg16,rgm8 o16 87 /rXCHG rg32,EAX o32 90+rgXCHG rg32,rm32 o32 87 /rXCHG rm16,rg16 o16 87 /rXCHG rm32,rg32 o32 87 /rXLATB D7XOR AL,ime8 34 ibXOR EAX,im32 o32 35 idXOR AX,im16 o16 35 iwXOR reg8,rgm8 32 /rXOR rgm8,ime8 80 /6 ibXOR rgm8,reg8 30 /rXOR rg16,rm16 o16 33 /rXOR rg32,rm32 o32 33 /rXOR rm16,ime8 o16 83 /6 ibXOR rm16,im16 o16 81 /6 iwXOR rm16,rg16 o16 31 /rXOR rm32,ime8 o32 83 /6 ibXOR rm32,im32 o32 81 /6 idXOR rm32,rg32 o32 31 /r

Page 163: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

163

17.6. Parsiranje instrukcije

Tipična instrukcija u asemblerskom jeziku je oblika

LABELA: OPCODE ARG1,ARG2,ARG3 ; KOMENTAR

pri čemu se često argumenti mogu izostaviti.

Početni dio najvažnije funkcije u asembleru GenerateHexInstruction, koja prevodi liniju u mašinski kod uheksadecimalnom formatu izdvaja ove elemente u posebne varijable.

Pored toga, unutar instrukcije se mogu nalaziti prefiksi za segmente i modifikatori kao što su NEAR i FAR. Oveprefikse i modifikatore treba izdvojiti iz instrukcije.

Izdvajanje dijelova asemblerske instrukcije u posebne varijable se može raditi sintaksnom analizom ili, što je ovdjeprimijenjeno jer je struktura asemblerskih instrukcija jednostavna korištenjem funkcije pos za traženje stringa na željenojpoziciji. To radi funkcija Izdvoji, čiji je prvi argument varijabla u koju će se smjestiti željeni dio stringa nakon parsiranja, adrugi je znak do kojeg se vrši izdvajanje. Treba još obraditi nekoliko specijalnih slučajeva, jer se labela kod instrukcija db, dwi dq ne završava dvotačkom, pa pogrešno biva prepoznata kao operacioni kod. Ti specijalni slučajevi se rješavaju naknadnimpromjenama i zamjenama varijabli.

Pronađene labele se smještaju u posebnu tabelu koja se zove labele. Tu se smješta ime labele i njena vrijednost, tevrsta. Nakon svake generisane instrukcije uvećava se trenutna pozicija i ova pozicija predstavlja vrijednost aktuelne labele.Ukupno postoje tri takve pozicije za code, data i stack segment.

17.7. Prepoznavanje adresnih režima

Izdvajanjem argumenata potrebno je prepoznati njegov adresni režim. Pentium II, kako se vidjelo u opisu tabele imadosta različitih adresnih režima. Da stvar bude složenija, oni se razlikuju zavisno od toga da li asembler generiše prevedeni kodu 16 bitnom ili 32-bitnom režimu.

Prepoznavanje, unutar funkcije ParseOp, se može obaviti pravljenjem sintaksnog dijagrama i zatim odgovarajućihprocedura, ali je u cilju smanjenja veličine samog asemblera primijenjen malo drugačiji pristup. Provjerava se da li pojedinipripada jednom od navedenih uzoraka na slici.

[A*B+C+D] -> tip:=13 [A+B*C+D] -> tip:=14 [A+B+C*D] -> tip:=15 [A*B+C-D] -> tip:=16 [A+B*C-D] -> tip:=17 [A-B+C*D] -> tip:=18 [A*B-C+D] -> tip:=19 [A*B+C] -> tip:=11 [A+B+C] -> tip:=10

[A*B-C] -> tip:=20 [A+B-C] -> tip:=21 [A-B+C] -> tip:=22 [A+B*C] -> tip:=12 [A*B] -> tip:=9 [A+B] -> tip:=8 [A-B] -> tip:=23 A[B*C+D] -> tip:=5 A[B*C-D] -> tip:=24

A[B+C*D] -> tip:=6 A[B*C] -> tip:=4 A[B+C] -> tip:=3 A[B-C] -> tip:=25 A[B] -> tip:=2 [A] -> tip:=7 A -> tip:=1 ;

Sl. 17.7.1. Uzorci argumenataTako na primjer, argument koji glasi [EAX*4+EBX-15] je tipa 16. Ovo prepoznavanje je takođe urađeno pomoću pos

naredbe, a moglo se i sintaksnom analizom. Funkcija uzorak provjerava da li se string slaže sa navedenim uzorkom i punivarijable A, B, C i D odgovarajućim stringovima. Tako na primjer Uzorak('[A*B+C-D]','[EAX*4+EBX-15]') će vratiti true inapuniti varijablu A vrijednošću EAX, varijablu B vrijednošću 4, varijablu C vrijednošću EBX i varijablu D vrijednošću 15.

Broj mogućih slučajeva je još uvijek preveliki pa je sada potrebno praviti ekvivalentne. Tako na primjer tipovi 5 i 18se mogu svesti na tip 13 zamjenom odgovarajućih varijabli. Svi se tipovi argumenata na kraju svedu na jedan od mogućihtipova: 1, 7, 8, 10, 11 i 13. No i ovo je još uvijek mnogo. Naime, argument [EAX*4+EBX+15] (tip 13) se može pisati na četirinačina:

[EAX*4+EBX+15] ili [4*EAX+EBX+15] ili [EAX*4+15+ EBX] ili [4*EAX+15+EBX]

Stoga, treba sortirati registre i konstante tako da se vrijednosti koje nisu registri stave na kraj argumenta. Prilikomovog sortiranja se pored ovoga adresiranja koja uključuju zbir registara BX/BP sa SI/DI takođe sortiraju da registri BX,odnosno BP dođu na početak argumenta.

Postoje još dva specijalna slučaja: kada navedena labela zapravo predstavlja čitanje s memorijske lokacije (sintaksaMOV AX,VRIJEDNOST zapravo se treba shvatiti kao MOV AX,[VRIJEDNOST]), te kada se slučaj [A+B] svodi na slučaj[A] ukoliko su A i B konstante.

17.8. Proračun modrm , SIB i deplasmana

Prepoznati tip argumenta sada treba prevesti u njegovo značenje. Za svaki od navedenih tipova postoje procedure kojese zovu Obrada1, Obrada7, Obrada8, Obrada10, Obrada11 i Obrada13. U okviru ovih procedura se gleda da li je pojediniod dijelova argumenta registar ili konstanta. Registar se prepoznaje funkcijom Regcode. Kada su prepoznati svi elementi , tadase u slog tipa Toperand upiše izračunata vrijednost bajta ModRM i bajta SIB.

Page 164: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

164Ukoliko je argument labela mora se pretražiti i u tabeli labela i naći njena vrijednost, čime se dalje ponaša kao da je u

pitanju konstanta. Vrijednosti dijelova argumenata koji predstavljaju konstante, deplasmane ili memorijske adrese smještaju seu polja disp8, disp16 ili disp32 zavisno od njihove veličine.

17.9. Punjenje i pretraživanje tabele instrukcija

Tabela instrukcija se prije početka asembliranja kompletna učita u memoriju i sortira.

Unutar funkcije GenerateHexInstruction se zatim poziva funkcija MakeOps unutar koje se poziva funkcijaParseOp. Zavisno od vrste argumenta zaključi se da li je riječ o osmobitnom registru (reg8), šesnaestbitnom registru (reg16),itd. kako je navedeno u tabeli u poglavlju 17.3. Argument može da se posmatra u više različitih konteksta. Tako na primjer kodinstrukcije

MOV EAX,[EBX]

za prvi argument važe konteksti: EAX rg32 rm32

a za drugi argument važe konteksti: memg mem8 mm16 mm32 mm64 mm80 rgm8 rm16 rm32 rm64

Sada je moguće pripremiti sve kombinacije argumenata, kao što su

MOV EAX,memgMOV EAX,mem8....MOV EAX,rm34MOV rg32,memgMOV rg32,mem8...MOV rm32,rm64

Nakon pripreme svih kombinacija operacionog koda i argumenata, slijedi binarno pretraživanje kroz tabelu. U tabelise pronalazi kao regularna kombinacija

MOV rg32,rm32 o32 8B /r

17.10. Generisanje heksadekadnog koda

Nakon pronalaska vrijednosti u tabeli generiše se heksadekadni kod prema uputama iz tabele. U primjeru o32 8B /r senajprije generišu bajtovi 67 i 66 zavisno od oblika operanada. Nakon toga se generiše prosto bajt 8B. Oznaka /r znači da semora prethodno zaključiti od kojeg argumenta se uzima ModRm, a od kojeg kod registra( u primjeru MOV EAX,[EBX]argument EAX predstavlja registar, a argument [EBX] definiše ModRM). Tako se kreira konačni ModRm, čime je instrukcijaprevedena u heksadekadni oblik

17.11. Numeričke konstante

Prilikom generisanja heksadekadnog koda instrukcije, dio argumenata su numeričke konstante ili labele. Ako seutvrdi da je riječ o labeli, vrši se pretraga kroz tabelu labela i uzima njena vrijednost, čime se problem svodi na evaluacijunumeričkih konstanti.

Dvije su vrste numeričkih konstanti, cjelobrojne i realne. Tehnika prevođenja cjelobrojnih konstanti je već izučena upoglavljima kompajlera, što se izvodi uzastopnim množenjem sa 10. Jedina specifičnost je što asemblerski programi koriste iheksadekadni i binarni brojni sistem. Stoga se u funkciji EvaluirajBroj provjerava da li se na kraju ASCII reprezentacije brojanalazi oznaka ‘b’ odnosno ‘h’, čime se konstanta kojom se uzastopno množi mijenja u 2, odnosno 16.

U šestoj verziji kompajlera FILDZAN-32 pretvaranje realnog broja u binarni format prepušteno je asembleru. Toznači da se sada mora pozabaviti konverzijom realnog broja iz ASCII reprezentacije u četvorobajtni, osmobajtni ilidesetobajtni IEEE format. To je realizovano funkcijom StrToFloat2. Format realnog broja je prilično mašinski ovisan. Zarazliku od dekadnih brojeva, pored uzastopnog množenja sa 10 za svaku cifru, broj se mora normalizovati ponovnimmnoženjem ili dijeljenjem mantise sa 10 i uvećavanjem, odnosno umanjivanjem eksponenta. Pored svega toga, potrebno jeprevesti ga u binarni format, i zatim spakovati iznose, kako Intel zahtijeva. Realizovati ovo potpuno u višem programskomjeziku rezultuje velikim numeričkim greškama. U cilju skraćenja asemblera (a po cijenu smanjenja njegove portabilnosti, ali dali je ona bitna za asembler?) množenje sa 10 i konverzija u binarni format (u suštini prosta FSTP instrukcija) realizovana jeugniježđenim asemblerom.

17.12. Pseudoinstrukcije, prefiksi i modifikatori

Određene instrukcije se ne nalaze u tabeli. To su instrukcije DD, DW, DB, DQ, DT, END, PUBLIC, .486 itd. To sustandardne asemblerske pseudoinstrukcije. Ovaj asembler je po izboru standardnih instrukcija bogat, jer pokriva cijeli skupPentiuma II, dok mnogi PC asembleri završavaju sa procesorom 486. Međutim, nije implementirano mnogo pseudoinstrukcija(nedostaju makroinstrukcije, pa čak i obična ORG instrukcija). Ove se istrukcije prepoznaju funkcijom IsPseudo, a generisanjekoda za njih procedurom DoPseudo.

Page 165: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

165Prilikom prepoznavanja instrukcije se provjeri da li ona sadrži prefikse kao što su ES:, CS:, SS:, ... REP itd. Ako

sadrže, treba generisati odgovarajući kod i za njih. Modifikatori kao što su NEAR i FAR se zamjenjuju njihovim dodavanjemna kraj operacionog koda instrukcije uz pomoć znaka podvlačilice.

17.13. Prvi prolaz

Sada kada je realizovano prevođenje pojedinačne instrukcije, što je i najteži dio posla, može se prevesti cijeliprogram. Između asemblerskih instrukcija nema velike međuzavisnosti, kakva postoji između instrukcija u programskimjezicima visokog nivoa, tako da kada je realizovano prevođenje jedne instrukcije, prevođenje cijelog programa je laganzadatak. Ipak, labele predstavljaju problem jer se instrukcije često referenciraju na labele koje još nisu definisane. Stoga jepotrebno dva puta proći kroz izvornu datoteku. U prvom prolazu se dođe do heksadecimalne vrijednosti instrukcije i puni setabela labela prilikom svake generisane labele, ali se heksadecimalna vrijednost intrukcije nigdje ne upisuje.

17.14. Drugi prolaz i generisanje koda

U drugom prolazu se generiše 5 datoteka:

Datoteka sa ekstenzijom .COD koja sadrži generisani kod iz CODE segmenta

Datoteka sa ekstenzijom .DAT koja sadrži generisane podatke iz DATA segmenta

Datoteka sa ekstenzijom .STA koja sadrži generisani kod iz STACK segmenta

Datoteka sa ekstenzijom .LAB koja sadrži spisak labela

Datoteka sa ekstenzijom .PAT koja sadrži popravke, tj. adrese na kojima se referencira pojedina labela

Cijeli asembler se starta naredbom

ASEM ime.asm /d za 16-bitno, DOS asembliranje

ASEM ime.asm /w za 32-bitno, Windows asembliranje

17.15. Izvršna verzija

Sa ovim asemblerom je dobijen mašinski kod ali treba još učiniti stvari da bi on bio izvršni na DOS ili Windowsoperativnom sistemu. Mašinski kod je u linearnom formatu. U nekim drugim slučajevima, ovaj format je najbolji. To surecimo loaderi operativnih sistema. To je prirodni format i pokazuje mašinski jezik onakav kakav on zaista jeste, ali ima svojenedostatke. U slučaju DOS-a, on je ograničen na veličinu segmenta od 64 K U slučaju Windowsa, tog ograničenja nema, alinije moguće povezati program sa dinamičkim bibliotekama.

DOS programi generisani ovim asemblerom se mogu učitati i startati ukoliko nemaju podataka u DATA segmentuprostim preimenovanjem datoteke sa ekstenzijom .COD u datoteku sa ekstenzijom .COM. U slučaju da ima podataka u DATAsegmentu i ako asemblerski program počinje sa

MOV AX,CSADD AX,<duzina CODE segmenta DIV 16 +1>MOV DS,AX

Tada se mogu spojiti datoteke sa ekstenzijom COD i DAT u jedinstveni COM program, pri čemu se DAT datotekasmješta na prvu poziciju djeljivu sa 16 od početka COM datoteke iza iskopirane COD datoteke. Pored ovog zahvata potrebnoje provjeriti PAT datoteku ukoliko se referiše program na podatke i promijeniti adrese u programu.

Međutim, ovo nije primjenjivo za Windows programe, što je primarni zadatak ovog asemblera. Potrebno je sadakonvertovati program u takav format da ga može razumjeti standardni linker.

Stoga je sljedeći logičan korak je generisanje COFF objektnog formata (ekstenzija OBJ). Ovaj format sadrži mašinskikod, ali i sve potrebne informacije da bi linker mogao da poveže modul sa drugim modulima praveći izvršni EXE program. Utu svrhu su pripremljene tabele labela i tabele popravki . Sve informacije postoje, samo ih je potrebno upakovati premastandardima.

U prilogu je dat listing cijelog asemblera.

Page 166: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

166

17.16. Listing AsembleraProgram asem;Type TLabTip = (lEqu, lprog, ldata, lextrn); TDsize = (d8, d16, d32, d64, d80); TLabela = Record labime: string[40]; labtip: TLabTip; labval: longint; labdsize: TDsize; End; texists=(exmodrm,exsib,exdisp8, exdisp16,exdisp32, exreg, exkind, exsegment); TOperand = Record existv: Set Of texists; datasizes: Set Of TDsize; adrsizes: Set Of TDsize; modrm: byte; sib: byte; disp8: byte; disp16: word; disp32: longint; segnum: word; reg: byte; kind: integer; End; toptable = Record instr: string[35]; gencod: string[20]; End;

Var labele: Array[1..10000] Of TLabela; optable: Array[1..2000] Of TOptable; FPValue: Array[1..10] Of char; brlabela, actseg: integer; skok, dummyb: boolean; maxopcode, prolaz, dummy: integer; pozicija: Array[1..3] Of longint; patstr: string; ulaz, izlazlab, izlazpat: Text; izlazcode, izlazdata, izlazstack: File Ofbyte;

Function trim(st: string): string;Begin While (st <> '') and (st[1] = ' ') Do st := copy(st, 2, length(st)); While (st <> '') and (st[length(st)] = '') Do st := copy(st, 1, length(st) - 1); TRIM := ST;End;

Function uppercase(st: string): string;Var i: integer;Begin For i := 1 To length(st) Do If(st[i]>= 'a') and (st[i] <= 'z') Then st[i] := chr(Ord(st[i]) - 32); uppercase := st;End;

Function IntToStr(n: longint; base:cardinal): string;Var st, c, pr: string; ev: cardinal;Begin If (base = 10) and (n < 0) Then Begin pr := '-'; n := -n; End Else pr := ''; ev := n; c := '0123456789ABCDEF'; If ev = 0 Then st := '0' Else st := ''; While ev > 0 Do Begin st := c[(ev mod base) + 1] + st; ev := ev div base; End; IntToStr := pr + st;End;

Function inttohex(n, digits: longint):string;Var st: string; negative: boolean; i: integer;Begin If n < 0 Then Begin

n := -n; n := n - 1; negative := True; End Else negative := False; st := IntToStr(n, 16); While length(st)<digits Do st:= '0' + st; If negative Then Begin For i := 1 To length(st) Do Begin Case st[i] Of '0': st[i] := 'F'; '1': st[i] := 'E'; '2': st[i] := 'D'; '3': st[i] := 'C'; '4': st[i] := 'B'; '5': st[i] := 'A'; '6': st[i] := '9'; '7': st[i] := '8'; '8': st[i] := '7'; '9': st[i] := '6'; 'A': st[i] := '5'; 'B': st[i] := '4'; 'C': st[i] := '3'; 'D': st[i] := '2'; 'E': st[i] := '1'; 'F': st[i] := '0'; End; End; End; inttohex := st;End;

Function nadjilabelu(ime: string): integer;Var i: integer;Begin nadjilabelu := -1; For i := 1 To brlabela Do If ime = labele[i].labime Then Begin nadjilabelu := i; EndEnd;

Procedure upisilabelu(ime: string; adresa:integer; lt: TLabtip; ds: TDSize);Var p: integer;Begin p := NadjiLabelu(ime); If p = -1 Then Begin brlabela := brlabela + 1; p := brlabela; End; With labele[p] Do Begin labime := ime; labtip := lt; labval := adresa; labdsize := ds; End;End;

Function EvaluirajBroj(br: string; Var Greska: boolean): longint;Var i, p, c, baza, last, rez: longint; z: char;Begin Greska := False; rez := 0; i := 1; If br = '' Then Begin EvaluirajBroj := 0; greska := True; exit; End; If not (br[1] in ['0'..'9', '-']) Then greska := True; If (br[1] = '-')and(length(br) > 1) Then Begin p := -1; i := i + 1 End Else p := 1; Case br[length(br)] Of 'o', 'O': baza := 8; 'b', 'B': baza := 2; 'h', 'H': baza := 16; '0'..'9': baza := 10 Else Begin baza := 0;

greska := True; End; End; last := length(br); If baza <> 10 Then last := last - 1; While i <= last Do Begin z := br[i]; c := 16; If (z >= '0') and (z <= '9') Then c := Ord(z) - Ord('0'); If (z >= 'a') and (z <= 'f') Then c := Ord(z) - Ord('a') + 10; If (z >= 'A') and (z <= 'F') Then c := Ord(z) - Ord('A') + 10; If c >= baza Then greska := True; rez := rez * baza + c; i := i + 1; End; If greska Then rez := 0; Evaluirajbroj := p * rez;End;

Procedure UpisiIzlaz(outst: string);Var i: integer; b: byte; g: boolean;Begin For i:=0 To(length(outst)div2)-1 Do Begin b := evaluirajbroj('0' + copy(outst, i * 2 + 1, 2) + 'H', g); If prolaz = 2 Then Case actseg Of 1: Write(izlazcode, b); 2: Write(izlazdata, b); 3: Write(izlazstack, b); End; End;End;

Function regcode(reg: string; Var kind:integer): integer;Const Registers: Array[0..8, 0..7] Of string =(('AL','CL','DL','BL','AH','CH','DH','BH'), ('AX','CX','DX','BX','SP','BP','SI','DI'),('EAX','ECX','EDX','EBX','ESP','EBP','ESI','EDI'),('CR0','***','CR2','CR3','CR4','***','***','***'),('DR0','DR1','DR2','DR3','***','***','DR6','DR7'),('TR0','TR1','TR2','TR3','TR4','TR5','TR6','TR7'),('ES','CS','SS','DS','FS','GS',’***','***'),('ST0','ST1','ST2','ST3','ST4','ST5','ST6','ST7'),('MMX0','MMX1','MMX2','MMX3','MMX4','MMX5','MMX6', 'MMX7'));Var i, j: integer;Begin reg := uppercase(reg); If copy(reg, 1, 3) = 'ST(' Then reg := 'ST' + copy(reg, 4, 1); If copy(reg, 1, 4) = 'MMX(' Then reg := 'MMX' + copy(reg, 4, 1); For i := 0 To 8 Do For j := 0 To 7 Do If registers[i, j] = reg Then Begin regcode := j; kind := i; exit; End; regcode := -1; kind := -1;End;

Procedure deplasmani(Var op: TOperand;broj: longint; predzn: boolean);Begin op.existv := op.existv + [exdisp32]; op.disp32 := broj; If (predzn and (op.disp32 < 32768) and(op.disp32>-32769))or(not (predzn) and(op.disp32<65536)and(op.disp32 >= 0)) Then Begin op.existv := op.existv + [exdisp16]; op.disp16 := op.disp32; End; If (predzn and (op.disp32 < 128) and(op.disp32>-129)) or(not (predzn) and(op.disp32 < 256) and (op.disp32 >= 0))Then Begin

Page 167: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

167 op.existv := op.existv + [exdisp8]; op.disp8 := op.disp32; End;End;

Procedure ResolveDisp(Var disp, unknown:string);Var kind: integer; greska: boolean; n: longint;Begin unknown := ''; If regcode(disp, kind)<>-1 Then exit; dummy := EvaluirajBroj(disp, greska); If not (greska) Then exit; n := nadjilabelu(disp); If n<>-1 Then Begin patstr := disp; disp := IntToStr(labele[n].labval, 10); exit End Else Begin unknown := ''; disp := '0'; End;End;

Procedure zamijeni(Var x, y: string);Var z: string;Begin z := x; x := y; y := z;End;

Function progutaj(st: string; Var puni:string): boolean;Var n: integer;Begin n := pos(st, uppercase(puni)); If n > 0 Then Begin puni := trim(copy(puni,1,n-1)+copy( puni, n + length(st), length(puni))); progutaj := True; End Else progutaj := False;End;

FUNCTION parseOp(arg: string; Var op:TOperand; b32: boolean): boolean;Var tip: integer; n: longint; Greska, ponovifazu: boolean; A, B, C, D: string; A1, B1, C1, D1, unknown, dsp: string; kind, po: integer;

Procedure setmod(x: byte); Begin op.modrm := x; op.existv := op.existv + [exmodrm]; End;

Procedure setsib(x: byte); Begin op.sib := x; op.existv := op.existv + [exsib]; End;

Function Uzorak(pattern,st:string):boolean; Var m: string; i: integer; Begin Uzorak := True; If pattern = 'A' Then Begin a := st; exit End; For i := 1 To length(pattern) Do Begin If pattern[i]in['A','B','C','D'] Then Begin m:=copy(st,1, pos(pattern[i+1],st)-1); If m = '' Then uzorak := False; Case pattern[i] Of 'A': a := m; 'B': b := m; 'C': c := m; 'D': d := m; End; st := copy(st, pos(pattern[i + 1], st), length(st)); End Else st := copy(st, pos(pattern[i], st)

+ 1, length(st)); End; End;

Procedure Obrada1; { Slucaj A } Begin n := regcode(A, kind); If n<>-1 Then Begin op.existv := op.existv + [exreg]; op.reg := n; op.kind := kind; If kind in[0,1,2]Then SetMod(3*64+n); Case kind Of 0: op.datasizes := [d8]; 1, 6: op.datasizes := [d16]; 2, 3, 4, 5: op.datasizes := [d32]; 7, 8: op.datasizes := [d64]; End; End Else Begin If pos(':', A) = 0 Then Begin n := EvaluirajBroj(A, greska); Deplasmani(op, n, n < 0); End Else Begin op.segnum:=EvaluirajBroj(copy(A,1, pos(':', A) - 1), greska); op.existv:=op.existv + [exSegment]; n:=EvaluirajBroj(copy(A,pos(':',A)+ 1,length(A)), greska); Deplasmani(op, n, n < 0); End; End; End;

Procedure OBrada7; { Slucaj [A] } Begin n := regcode(A, kind); If n<>-1 Then Begin Case kind Of 1: Begin Case n Of 3: setmod(0 * 64 + 7); {BX } 6: setmod(0 * 64 + 4); {SI} 7: setmod(0 * 64 + 5); {DI} 5: Begin { BP} tip := 8;B := '0'; ponovifazu := True; End Else Greska := True; End; op.adrsizes := [d16]; End; 2: Begin Case n Of{EAX..EDI} 0..3,6,7:setmod(0*64+n); 4:Begin { ESP} setmod(0 * 64 + 4); {SIB} setsib(64 * 0 + 8 * 4 + 4); End; 5: Begin { EBP} tip := 8; B := '0'; ponovifazu := True; End Else Greska := True; End; op.adrsizes := [d32]; End Else Greska := True; {ni 16 ni 32bit} End; End Else Begin n := EvaluirajBroj(A, greska); Deplasmani(op, n, False); If b32 Then Begin op.existv := [exdisp32]; setmod(0 * 64 + 5); End Else Begin op.existv := [exdisp16]; setmod(0 * 64 + 6); End End End;

Procedure OBrada8; { Slucaj [A+B]} Var n2, m: longint; Begin n := regcode(A, kind); {Samo registar} If n = -1 Then Begin Greska := True; exit End; Case kind Of 1: Begin op.adrsizes := [d16]; n2 := regcode(B, kind);

If n2<>-1 Then Begin If kind <> 1 Then Greska := True Else{[bx+si],[bx+di],[bp+si],[bp+di]} If (n = 3) and (n2 = 6) Then setmod(0 * 64 + 0) Else If (n = 3) and (n2 = 7) Then setmod(0 * 64 + 1) Else If (n = 5) and (n2 = 6) Then setmod(0 * 64 + 2) Else If (n = 5) and (n2 = 7) Then setmod(0 * 64 + 3) Else Greska := True; End Else Begin m := 1; n2 := EvaluirajBroj(B, greska); Deplasmani(op, n2, True); If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp16 in op.existv Then Begin m := 2; op.existv := [exdisp16] End Else Greska := True; Case n Of 3: setmod(m*64+7); {[bx+disp]} 5: setmod(m*64+6); {[bp+disp]} 6: setmod(m*64+4); {[si+disp]} 7: setmod(m*64+5); {[di+disp]} Else Greska := True; End; End; End; 2: Begin { U 32 bita dopusteno samoREG+const. Za REG+REG koristi REG*1 + REG} op.adrsizes := [d32]; n2 := regcode(B, kind); If n2<>-1 Then Begin Greska := True; exit End; n2 := EvaluirajBroj(B, greska); Deplasmani(op, n2, True); m := 1; If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp32 in op.existv Then Begin m := 2; op.existv := [exdisp32] End Else Greska := True; If n <> 4 Then setmod(m * 64 + n) Else Begin {ESP} setmod(m * 64 + 4); setsib(64 * 0 + 8 * 4 + 4); End End Else Greska := True; { Ni 16 ni 32} End; End;

Procedure OBrada9; { Slucaj [A*B]} Var sc: integer; Begin n := regcode(A, kind); If (kind<>2)or(n=1)or(n=4)or(n=-1) or (length(b) <> 1) or (not (b[1] in ['1','2','4', '8'])) Then Begin Greska := True; exit; End; op.adrsizes := [d32]; sc := pos(b[1], '1248') - 1; setmod(0 * 64 + 4); setsib(64*sc+8*n+5); { EBP specijalan} End;

Procedure OBrada10; { Slucaj [A+B+C]} Var n2, n3, m: longint; Begin n := regcode(A, kind); If(kind <> 1) or not (n in [3, 5]) Then Begin Greska := True;

Page 168: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

168 exit; End; n2 := regcode(B, kind); If (kind<>1) or not (n2 in [6, 7]) Then Begin Greska := True; exit; End; n3 := regcode(C, kind); If (n3<>-1) Then Begin Greska := True; exit; End; n3 := EvaluirajBroj(C, greska); op.adrsizes := [d16]; Deplasmani(op, n3, True); m := 1; If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp16 in op.existv Then Begin m := 2; op.existv := [exdisp16] End Else Greska := True; If (n=3)and(n2=6)Then setmod(m*64+0) Else If (n=3)and(n2=7) Then setmod(m * 64 + 1) Else If (n = 5) and (n2 = 6) Then setmod(m * 64 + 2) Else If (n = 5) and (n2 = 7) Then setmod(m * 64 + 3) Else Greska := True; End;

Procedure OBrada11; { Slucaj [A*B+C]} Var sc, n2, m: longint; Begin n := regcode(A, kind); If (kind<>2)or(n=1)or(n=4)or(n = -1) or (length(b) <> 1) or (not (b[1] in ['1', '2', '4', '8'])) Then Begin Greska := True; exit; End; sc := pos(b[1], '1248') - 1; n2 := regcode(C, kind); op.adrsizes := [d32]; m := 1; If n2 = -1 Then Begin n2 := EvaluirajBroj(C, greska); Deplasmani(op, n2, True); If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp32 in op.existv Then Begin m := 2; op.existv := [exdisp32] End Else Greska := True; setmod(m * 64 + 4); setsib(64 * sc + 8 * n + 5); End Else Begin If kind <> 2 Then greska := True; If n2 = 5 Then Begin ponovifazu := True; tip := 13; D := '0'; exit End; setmod(0 * 64 + 4); setsib(64 * sc + 8 * n + n2); End; End;

Procedure OBrada13; { Slucaj [A*B+C+D]} Var sc, n2, n3, m: longint; Begin n := regcode(A, kind); If (n=-1)or(kind<>2)or(n=1)or(n=4) or (length(b) <> 1) or (not (b[1] in ['1','2','4', '8'])) Then Begin Greska := True; exit; End; sc := pos(b[1], '1248') - 1; n2 := regcode(C, kind); op.adrsizes := [d32]; If (n2 = -1) or (kind <> 2) Then Begin Greska := True; exit;

End; n3 := regcode(D, kind); If (n3<>-1) Then Begin Greska := True; exit; End; n3 := EvaluirajBroj(D, greska); Deplasmani(op, n3, True); m := 1; If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp32 in op.existv Then Begin m := 2; op.existv := [exdisp32] End Else Greska := True; setmod(m * 64 + 4); setsib(64 * sc + 8 * n + n2); End;Begin {Parseop} tip := -1; Greska := False; op.datasizes := []; If progutaj('BYTE', arg) Then op.datasizes := [d8] Else If progutaj('DWORD', arg) Then op.datasizes := [d32] Else If progutaj('QWORD', arg) Then op.datasizes := [d64] Else If progutaj('TWORD', arg) Then op.datasizes := [d80] Else If progutaj('WORD', arg) Then op.datasizes := [d16]; dummyb := progutaj('PTR', arg); { Prva faza: Obrada raznih slucajevaoperanda} arg := trim(arg); If length(arg) >= 3 Then If(arg[1]='''')and(arg[3]='''') Then arg := IntToStr(Ord(arg[2]), 10); If uzorak('[A*B+C+D]',arg)Then tip := 13Else If uzorak('[A+B*C+D]',arg)Then tip:=14Else If uzorak('[A+B+C*D]',arg)Then tip:=15Else If uzorak('[A*B+C-D]',arg)Then tip:=16Else If uzorak('[A+B*C-D]',arg)Then tip:=17Else If uzorak('[A-B+C*D]',arg)Then tip:=18Else If uzorak('[A*B-C+D]',arg)Then tip:=19Else If uzorak('[A*B+C]',arg)Then tip:=11Else If uzorak('[A+B+C]',arg)Then tip:=10Else If uzorak('[A*B-C]',arg)Then tip:=20Else If uzorak('[A+B-C]',arg)Then tip:=21Else If uzorak('[A-B+C]',arg)Then tip:=22Else If uzorak('[A+B*C]',arg)Then tip:=12Else If uzorak('[A*B]',arg)Then tip:=9Else If uzorak('[A+B]',arg)Then tip:=8Else If uzorak('[A-B]',arg)Then tip:=23Else If uzorak('A[B*C+D]',arg)Then tip:=5Else If uzorak('A[B*C-D]',arg) Then tip:=24Else If uzorak('A[B+C*D]',arg) Then tip:=6Else If uzorak('A[B*C]',arg) Then tip:=4Else If uzorak('A[B+C]',arg) Then tip:=3Else If uzorak('A[B-C]',arg) Then tip:=25Else If uzorak('A[B]',arg) Then tip:=2Else If uzorak('[A]',arg) Then tip:=7Else If uzorak('A',arg) Then tip:=1; If tip = -1 Then greska := True; If not (greska) Then Begin { Druga faza:Smanjivanje broja slucaja} Case tip Of 16: Begin D := '-' + D; tip := 13 End; 17: Begin D := '-' + D; tip := 14 End; 18: Begin B := '-' + B; tip := 15 End; 19: Begin C := '-' + C; tip := 13 End; 20: Begin C := '-' + C; tip := 11 End; 21: Begin C := '-' + C; tip := 10 End; 22: Begin B := '-' + B; tip := 10 End; 23: Begin B := '-' + B; tip := 8 End; 24: Begin D := '-' + D; tip := 5 End;

25: Begin C := '-' + C; tip := 3 End; End; A1 := A; B1 := B; C1 := C; D1 := D; Case tip Of 2: tip := 8; 3: tip := 10; 4: Begin a := b1; b := c1; c := a1; tip := 11; End; 5: Begin d := a1; c := d1; b := c1; a := b1; tip := 13; End; 6: Begin d := a1; c := b1; a := c1; b := d1; tip := 13; End; 12: Begin c := a1; a := b1; b := c1; tip := 11; End; 14: Begin a := b1; b := c1; c := a1; d := d1; tip := 13; End; 15: Begin a := c1; b := d1; c := a1; d := b1; tip := 13; End; End; { Treca faza, deplasman na kraj} Case tip Of 8: Begin If regcode(A, kind) = -1 Then zamijeni(A, B); If regcode(B, kind) in [3, 5] Then If kind = 1 {16 bit} Then zamijeni(A, B); End; 10: Begin If regcode(A, kind) = -1 Then zamijeni(A, C); If regcode(B, kind) = -1 Then zamijeni(B, C); If regcode(B, kind) in [3, 5] Then If kind = 1 {16 bit} Then zamijeni(A, B); End; 9, 11: Begin If regcode(A, kind) = -1 Then zamijeni(A, B); End; 13: Begin If regcode(A, kind) = -1 Then zamijeni(A, B); If regcode(C, kind) = -1 Then zamijeni(C, D); End; End;{ Cetvrta faza, proracun deplasmana, slucajA moze postati [A] ako je rijec o labeli,slucaj [A+B] moze postati [A] ako ni jedannije registar } If tip = 8 Then Begin If (RegCode(A, kind) = -1) and (RegCode(B,kind)=-1) Then Begin If (A[1] in ['0'..'9']) and not (B[1] in ['0'..'9']) Then Begin patstr := B; End Else Begin dsp := A + '+' + B; ResolveDisp(A, unknown); ResolveDisp(B, unknown); patstr := dsp; A := IntToStr(EvaluirajBroj(A, greska) + EvaluirajBroj(B, greska), 10); End; B := ''; tip := 7; End; End; If tip = 1 Then Begin If not (progutaj('OFFSET', A)) Then If RegCode(A,kind)=-1 Then Begin dummy := EvaluirajBroj(A,greska); If Greska Then Begin {Trazi labl} po := nadjilabelu(A); If(po=-1)and(skok = False) Then tip := 7 { Pretpostavka} Else If labele[po].labtip=ldata Then Begin tip := 7; op.datasizes:= [labele[po].labdsize]; End; End

Page 169: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

169 End End; unknown := ''; Case tip Of 1: If pos(':', A) = 0 Then ResolveDisp(A, unknown); 7: ResolveDisp(A, unknown); 8: ResolveDisp(B, unknown); 10, 11: ResolveDisp(C, unknown); 13: ResolveDisp(D, unknown); End; greska := False; { Peta faza kalkulacija mod/rm, SIB ideplasmana } op.existv := []; op.adrsizes := []; repeat ponovifazu := False; Case tip Of 1: Obrada1; 7: Obrada7; 8: Obrada8; 9: Obrada9; 10: Obrada10; 11: Obrada11; 13: Obrada13; End; UNTIL not (ponovifazu); End; If greska Then parseop := False Else parseop := True;End;

Procedure ReadOpcodeTable;Var i, j: integer; f: Text; st: string; t: toptable;Begin maxopcode := 0; Assign(f, 'opcod.txt'); reset(f); While not EOF(f) Do Begin readln(f, st); maxopcode := maxopcode + 1; optable[maxopcode].instr := trim(copy(st, 1, 20)); optable[maxopcode].gencod := copy(st, 21, 20); End; For i := 1 To maxopcode - 1 Do For j := i + 1 To maxopcode Do If optable[i].instr > optable[j].instr Then Begin t := optable[i]; optable[i] := optable[j]; optable[j] := t; End;End;

Function Binsearch(instr: string): integer;Var high, j, low: integer;Begin low := 0; high := maxopcode; While high - low > 1 Do Begin j := (high + low) div 2; If instr<=optable[j].instr Then high:=j Else low := j End; If optable[high].instr=instr Then Binsearch:=high Else Binsearch := -1;End;{*******************}Function GenerateHexInstruction(inst:string; b32: boolean): string;Label postoji;Var labela, opcode, arg1, arg2, arg3, comb1, comb2,comb3, cf: string; op1, op2, op3: TOperand; p, i, j, k, n: integer; b1, greska, no67: boolean; g1, outstr, st, modif: string; modski, registarski: integer;

Procedure izdvoji(Var x:string;sep:char); Begin If st = '' Then Begin x := ''; exit End; p := pos(sep, st);

If p > 0 Then Begin x := trim(copy(st, 1, p - 1)); st:=trim(copy(st,p+1,length(st)-p)); End Else Begin If sep = ':' Then x := '' Else Begin x := trim(st); st := ''; End End End; Procedure ClearOp(Var op: TOperand); Begin With op Do Begin existv := []; datasizes := []; adrsizes := []; modrm := 0; sib := 0; disp8 := 0; disp16 := 0; disp32 := 0; segnum := 0; reg := 0; kind := 0; End; End; Function MakeOps(arg: string; VAR op: TOperand; Var rez: string): boolean; Begin If not(parseop(arg,op,b32))Then Begin Makeops := False; exit; End; If length(arg) <= 4 Then rez := copy(arg + ' ', 1, 4) Else rez := ''; If exsegment in op.existv Then Begin If exdisp16 in op.existv Then rez:= rez + 's:16'; If(exdisp32 in op.existv)and b32 Then rez := rez + 's:32'; End Else If exreg in op.existv Then Begin Case op.kind Of 0: rez := rez + 'reg8rgm8'; 1: rez := rez + 'rg16rm16'; 2: rez := rez + 'rg32rm32'; 3: rez := rez + 'creg'; 4: rez := rez + 'dreg'; 5: rez := rez + 'treg'; 6: rez := rez + 'segr'; 7: rez := rez + 'fpur'; 8: rez := rez + 'mmxr'; End; End Else Begin { Memorija ili neposredno} If exmodrm in op.existv Then Begin rez := rez + 'memg'; If op.datasizes = [] Then rez := rez +'mem8mm16mm32mm64mm80rgm8rm16rm32rm64' Else Begin If d8 in op.datasizes Then rez := rez + 'mem8rgm8'; If d16 in op.datasizes Then rez := rez + 'mm16rm16'; If d32 in op.datasizes Then rez := rez + 'mm32rm32'; If d64 in op.datasizes Then rez := rez + 'mm64rm64'; If d80 in op.datasizes Then rez := rez + 'mm80rm80'; End; If b32 and (op.modrm = 5) Then rez := rez + 'ab32'; If not(b32) and (op.modrm = 6) Then rez := rez + 'ab16abs8'; End Else Begin rez := rez + 'immg'; If exdisp8 in op.existv Then rez := rez + 'ime8'; If exdisp16 in op.existv Then rez := rez + 'im16'; If exdisp32 in op.existv Then rez := rez + 'im32'; End End; MakeOps := True; End;

Function endian16(a: string): string; Begin endian16:=copy(a,3,2)+ copy(a, 1, 2); End; Function endian32(a: string): string;

Begin endian32:=copy(a,7,2)+ copy(a, 5, 2) + copy(a, 3, 2) + copy(a, 1, 2); End; Function end1632(a:string;n:TDsize): string; Begin Case n Of d16: end1632 := Endian16(a); d32: end1632 := Endian32(a); Else end1632 := a; End; End; Procedure writemodrm(slobodni: integer); Var op: toperand; mrm: byte; Begin If modski = 1 Then op := op1 Else If modski = 2 Then op := op2 Else greska := True; If slobodni = 8 Then Begin If registarski = 1 Then slobodni := op1.reg Else If registarski = 2 Then slobodni := op2.reg Else greska := True; End; mrm:=(op.modrm)and($C7)or(slobodni*8); outstr := outstr + inttohex(mrm, 2); If patstr<>''Then patstr:=patstr+' ' + IntToStr(pozicija[actseg] +length(outstr) div 2,10) + ' A'; If exSIb in op.existv Then outstr:=outstr + inttohex(op.sib, 2); If exdisp8 in op.existv Then outstr:=outstr+inttohex(op.disp8, 2) Else If exdisp16 in op.existv Then outstr := outstr + endian16(inttohex(op.disp16, 4)) Else If exdisp32 in op.existv Then outstr := outstr + endian32(inttohex(op.disp32, 8)); End;

Procedure writedisp(ex: texists); Var op: TOperand; Begin If (arg1<>'')and(ex in op1.existv) Then op := op1 Else If(arg2<>'')and(ex in op2.existv)Then op := op2 Else If(arg3<>'')and(ex in op3.existv)Then op := op3 Else greska := True; If patstr <> '' Then Begin patstr := patstr + ' ' + IntToStr(pozicija[actseg] + length(outstr) div 2, 10) + ' D'; op.disp32 := 0; {za coff} End; If ex = exdisp8 Then outstr:=outstr+ (inttohex(op.disp8,2)); If ex = exdisp16 Then outstr := outstr + endian16(inttohex (op.disp16, 4)); If ex = exdisp32 Then outstr := outstr + endian32(inttohex( op.disp32, 8)); End;

Procedure writeseg; Begin outstr := outstr + endian16(inttohex( op1.segnum, 4)); End; Procedure writerel(offs:longint; ex: texists); Var op: TOperand; Function test(a,min,max:integer): integer; Begin If (a < min) or (a > max) Then greska := True; test := a; End; Begin If (arg1 <> '') Then op := op1 Else If (arg2 <> '') Then op := op2 Else If (arg3 <> '') Then op := op3 Else greska := True; If ((op.disp32 = 0) and (prolaz = 1)) or (op.disp32 = -1) Then

Page 170: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

170 op.disp32 := offs; If patstr<>'' Then patstr := patstr + ' ' + IntToStr(pozicija[actseg] + length(outstr) div 2, 10) + ' R'; If ex = exdisp8 Then outstr := outstr + {malo drugacije jer je rijec o razlici} (inttohex(test(op.disp32 - offs, - 128, 127), 2)); If ex = exdisp16 Then outstr := outstr + endian16(inttohex(test(op.disp32 - offs, - 32768, 32767), 4)); If ex = exdisp32 Then outstr := outstr + endian32(inttohex(op.disp32-offs,8)); End;

Function dod(n: integer): integer; Begin dod := (length(outstr) div 2) + n; End; Procedure prefix(pr, cod: string); Begin If progutaj(pr,st)Then outstr := outstr + cod; End; Procedure modifikator(pr: string); Begin If progutaj(pr,st)Then modif:='_' + pr; End; Function ispseudo(x: string): boolean; Begin x := copy(x, 1, 3); If (x='DB ')or(x='DW ')or(x = 'DD ')Or (x='DQ ')or(x='DT ') Then Begin ispseudo := True End Else ispseudo := False; End;

Function posnostr(bb: char; s1: string):integer; Var odsijeci, ustringu: boolean; i: integer; Begin i := 1; odsijeci := False; ustringu := False; While not (odsijeci) Do Begin If i>length(s1) Then odsijeci := True Else Begin If s1[i] = chr(39) Then ustringu := not (ustringu); If not(ustringu)and(s1[i]=bb) Then odsijeci := True Else i := i + 1; End; End; If i <= length(s1) Then posnostr := i Else posnostr := 0; End;

Procedure StrToFloat2(tekstime: string;ValueType: char); Label WriteNum, GetExponent, DivExp; Const CWNear: word = $133F; DCon10: integer = 10; Var Temp: integer; CtrlWord: word; Brojac,DecCifara, Exponent, i: integer; Negative, ExpNegative: boolean; Begin Brojac := 1; If length(tekstime) = 0 Then exit; While tekstime[Brojac] = ' ' Do Begin Brojac := Brojac + 1; If brojac>length(tekstime) Then exit; End; ExpNegative := False; Negative := False; DecCifara := 0; If tekstime[Brojac] = '+' Then Brojac := Brojac + 1 Else If tekstime[Brojac]='-'Then Begin Brojac := Brojac + 1; Negative := True; End; If brojac > length(tekstime) Then exit; If not (tekstime[Brojac] in ['0'..'9', '.']) Then exit; asm FSTCW CtrlWord FCLEX

FLDCW CWNear FLDZ End; While tekstime[Brojac] in ['0'..'9'] Do Begin Temp:=Ord(tekstime[Brojac])-Ord('0'); asm FIMUL DCon10 FIADD Temp End; Brojac := Brojac + 1; End; If brojac > length(tekstime) Then Goto writenum; If tekstime[Brojac] = '.' Then Brojac := Brojac + 1 Else If tekstime[Brojac]in['e','E']Then Goto GetExponent; If brojac > length(tekstime) Then Goto writenum; While tekstime[Brojac]in['0'..'9'] Do Begin Temp:=Ord(tekstime[Brojac])-Ord('0'); asm FIMUL DCon10 FIADD Temp End; Brojac := Brojac + 1; DecCifara := DecCifara + 1; End; Exponent := -DecCifara; If brojac>length(tekstime)Then Goto DivExp; If not(tekstime[Brojac]in['e','E'])Then Goto DivExp; Brojac := Brojac + 1; If tekstime[Brojac] = '+' Then Brojac := Brojac + 1 Else If tekstime[Brojac]='-'Then Begin Brojac := Brojac + 1; ExpNegative := True; End; If brojac > length(tekstime) Then Goto writenum;GetExponent: Exponent := 0; While tekstime[Brojac] in ['0'..'9'] Do Begin Temp:=Ord(tekstime[Brojac])-Ord('0'); Exponent := Exponent * 10 + temp; Brojac := Brojac + 1; End; If ExpNegative Then Exponent := -Exponent; Exponent := Exponent - DecCifara;DivExp: If Exponent > 0 Then For i := 1 To Exponent Do Begin asm FIMUL DCon10 End; End Else For i := 1 To -Exponent Do Begin; asm FIDIV DCon10 End End; If Negative Then asm FCHS End;writenum: Case ValueType Of 'T': asm FSTP TBYTE PTR FPValue End; 'Q': asm FSTP QWORD PTR FPValue End; 'D': asm FSTP DWORD PTR FPValue End; End; End;

Procedure dopseudo; Var sz, p, d: integer; dsz: TDSize; bajtovi, element: string; Procedure putdb(Var vr: string); Var i, j, puta: integer; Begin d := pos('DUP(', vr); If d > 0 Then Begin puta:=EvaluirajBroj(trim(copy(vr, 1,d-1)), greska); vr:=trim(copy(vr,d+4,pos(')', vr) – d - 4)); End

Else puta := 1; pozicija[actseg]:=pozicija[actseg] + (length(outstr) div 2); UpisiIzlaz(outstr); outstr := ''; For i := 1 To puta Do Begin If (vr[1] = chr(39)) and (vr[length(vr)] = chr(39)) and (opcode[2] = 'B') Then Begin For j := 2 To length(vr) - 1 Do Begin outstr := outstr +inttohex( Ord(vr[j]), 2); End; End Else Begin If pos('.', vr) > 0 Then Begin StrToFloat2(vr, opcode[2]); For j := 1 To sz div 2 Do outstr := outstr + IntTohex( Ord(FPValue[j]), 2); End Else outstr := outstr + end1632( Inttohex(EvaluirajBroj(vr, greska), sz), dsz); End; If i <> puta Then Begin pozicija[actseg]:=pozicija[actseg] +(length(outstr) div 2); UpisiIzlaz(outstr); outstr := ''; End End End; Begin opcode := copy(opcode, 1, 3); Case opcode[2] Of 'B': Begin sz := 2; dsz := d8 End; 'W': Begin sz := 4; dsz := d16 End; 'D': Begin sz := 8; dsz := d32 End; 'Q': Begin sz := 16; dsz := d64 End; 'T': Begin sz := 20; dsz := d80 End; Else Begin sz := 2; dsz := d8 End; End; If labela <> '' Then UpisiLabelu(labela, pozicija[actseg], ldata, dsz); bajtovi := trim(copy(inst, pos(opcode, inst) + 3,length(inst))); While (posnostr(',', bajtovi) > 0) Do Begin p := posnostr(',', bajtovi); element:=trim(copy(bajtovi,1,p-1)); bajtovi := trim(copy(bajtovi, p + 1, length(bajtovi))); putdb(element); End; If bajtovi <> '' Then putdb(bajtovi); If greska Then outstr := ''; End;Begin {Generate Hex instruction} p := posnostr(';', inst); If p > 0 Then inst := copy(inst, 1, p - 1); st := inst; outstr := ''; prefix('ES:', '26'); prefix('CS:', '2E'); prefix('SS:', '36'); prefix('DS:', '3E'); prefix('FS:', '64'); prefix('GS:', '65'); prefix('REP ', 'F3'); prefix('REPE ', 'F3'); prefix('REPNE ', 'F2'); prefix('REPZ ', 'F3'); prefix('REPNZ ', 'F2'); prefix('LOCK ', 'F0'); modif := ''; modifikator('NEAR'); modifikator('FAR'); izdvoji(labela, ':'); izdvoji(opcode, ' '); izdvoji(arg1, ','); izdvoji(arg2, ','); izdvoji(arg3, ';'); If pos(' ', labela) > 0 Then Begin

Page 171: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

171 { JMP , CALL A:B} arg1 := copy(labela,pos(' ',labela)+1, length(labela)) + ':' + opcode; opcode := copy(labela, 1, pos(' ', labela) - 1); End; opcode := opcode + modif; If ispseudo(arg1) Then Begin labela := opcode; opcode := arg1; End; If ispseudo(opcode) Then Begin DoPseudo; GenerateHexInstruction := outstr; Exit; End; b1 := True; skok := False; If length(opcode) > 1 Then If(opcode[1]='J')or(opcode='CALL') Then skok := True; If (labela <> '') and (prolaz = 1) Then Begin UpisiLabelu(labela, pozicija[actseg], lprog, d32); End; If opcode = '' Then Begin GenerateHexInstruction := 'XX'; exit; End; ClearOp(op1); ClearOp(op2); ClearOp(op3); If arg1 <> '' Then b1 := Makeops(arg1, op1, comb1); If arg2 <> '' Then b1 := b1 and Makeops(arg2, op2, comb2); If arg3 <> '' Then b1 := b1 and Makeops(arg3, op3, comb3); If not (b1) Then greska := True; If (arg1='')and(arg2='')and(arg3='') Then Begin n := binsearch(opcode); If n<>-1 Then Goto postoji; End; If (arg1<>'')and(arg2='')and(arg3='')Then For i := 1 To length(comb1) div 4 Do Begin st := opcode; st:=st+' '+ TRIM(copy(comb1,(I-1)*4+ 1, 4)); n := binsearch(st); If n<>-1 Then Goto postoji; End; If (arg2 <> '') and (arg3 = '') Then For i := 1 To length(comb1) div 4 Do For j := 1 To length(comb2) div 4 Do Begin st := UPPERCASE(opcode); st := st + ' ' + TRIM(copy( comb1, (I - 1) * 4 + 1, 4)); st := st + ',' + TRIM(copy( comb2, (j - 1) * 4 + 1, 4)); n := binsearch(st); If n<>-1 Then Goto postoji; End; If arg3 <> '' Then For i := 1 To length(comb1) div 4 Do For j := 1 To length(comb2) div 4 Do For k:=1 To length(comb3) div 4 Do Begin st := UPPERCASE(opcode); st := st + ' ' + TRIM(copy( comb1, (I - 1) * 4 + 1, 4)); st := st + ',' + TRIM(copy( comb2, (j - 1) * 4 + 1, 4)); st := st + ',' + TRIM(copy( comb3, (K - 1) * 4 + 1, 4)); n := binsearch(st); If n<>-1 Then Goto postoji; End; greska := True; GenerateHexInstruction := ''; exit;postoji: g1 := Optable[n].gencod; no67 := True; If (copy(g1, 1, 3) = 'o16') and b32 Then outstr := outstr + '66'; If(copy(g1,1,3)='o32') and not (b32) Then outstr := outstr + '66'; If ((copy(g1, 1, 3) = 'a16') and b32) or ((copy(g1,1,3)='a32')and not(b32)) Then Begin outstr := outstr + '67'; no67 := False; End; If G1[1] <> ' ' Then g1 := copy(g1, 4, length(g1)); g1 := trim(g1) + ' '; modski := 0; registarski := 0; For i := 1 To length(g1) div 3 Do

Begin If (arg1<>'')and(arg2<>'')Then Begin If (exmodrm in op1.existv) Then modski := 1; If (exmodrm in op2.existv) Then modski := 2; If (exreg in op1.existv) Then registarski := 1; If (exreg in op2.existv) Then registarski := 2; If (exmodrm in op1.existv) and (exreg in op2.existv) Then Begin modski := 1; registarski := 2; End; If (exmodrm in op2.existv) and (exreg in op1.existv) Then Begin modski := 2; registarski := 1; End; End; If (arg1 <> '')and(arg2='') Then Begin If (exmodrm in op1.existv) Then modski := 1; If (exreg in op1.existv) Then registarski := 1; End; If g1[i * 3] = ' ' Then Begin cf := copy(g1, i * 3 - 2, 2); If cf = '/r' Then Begin writemodrm(8); End Else If(cf>='/0')and(cf<= '/9') Then Begin writemodrm(Ord(cf[2]) - Ord('0')); End Else If cf = 'ib' Then Begin writedisp(exdisp8); End Else If cf = 'sw' Then Begin writedisp(exdisp16); writeseg; End Else If cf = 'sd' Then Begin writedisp(exdisp32); writeseg; End Else If (cf = 'iw') or ((cf = 'o?') and not (b32)) Then Begin writedisp(exdisp16); End Else If (cf = 'id') or ((cf = 'o?') and (b32)) Then Begin writedisp(exdisp32); End Else If cf = 'rb' Then Begin writerel(pozicija[actseg] + dod(1), exdisp8); End Else If (cf = 'rw') or ((cf = 'r?') and not (b32)) Then Begin writerel(pozicija[actseg] + dod(2), exdisp16); End Else If (cf = 'rd') or ((cf = 'r?') and b32) Then Begin writerel(pozicija[actseg] + dod(4), exdisp32); End Else If(cf<>'rg')and(cf<>'cc') Then outstr := outstr + cf End; If g1[i * 3] = '+' Then Begin If copy(g1,i*3+1,2)='rg' Then Begin If exreg in op1.existv Then n := op1.reg Else If exreg in op2.existv Then n := op2.reg Else greska := True; outstr := outstr + Inttohex(evaluirajbroj('0' + copy(g1, i * 3 - 2, 2) + 'h', greska) + n, 2); End; End; End; If no67 Then Begin If b32 and (d16 in op1.adrsizes + op2.adrsizes) Then outstr := '67' + outstr; If not (b32) and (d32 in op1.adrsizes + op2.adrsizes) Then outstr := '67' + outstr; End; If not (greska) Then GenerateHexInstruction := outstr Else GenerateHexInstruction := '';End;

Procedure Glavni;

Var inst, outst, par: string; opt: boolean; i: integer; Procedure ac(n: integer); Begin actseg := n; inst := ''; End;Begin opt := True; {32 bit } If ParamStr(2) = '/d' Then opt := False; If ParamStr(2) = '/w' Then opt := True; par := uppercase(ParamStr(1)); If pos('.ASM', par) > 0 Then par:=copy(par,1,pos('.ASM', par) - 1); Assign(ulaz, ParamStr(1)); Assign(izlazcode, par + '.cod'); Assign(izlazdata, par + '.dat'); Assign(izlazstack, par + '.sta'); Assign(izlazlab, par + '.lab'); Assign(izlazpat, par + '.pat'); prolaz := 1; While prolaz <= 2 Do Begin reset(ulaz); If opt Then pozicija[1] := 0 Else pozicija[1] := 256; pozicija[2] := 0; pozicija[3] := 0; actseg := 1; If prolaz = 2 Then Begin rewrite(izlazcode); rewrite(izlazdata); rewrite(izlazstack); rewrite(izlazlab); rewrite(izlazpat); End; While not EOF(ulaz) Do Begin readln(ulaz, inst); inst := trim(inst); If inst = '.CODE' Then ac(1); If inst = '.DATA' Then ac(2); If inst = '.STACK' Then ac(3); If (inst = '.486') or (inst = 'OPTION CASEMAP:NONE') or (inst = '.MODEL FLAT,STDCALL') or (inst = '.386') Then inst := ''; If (uppercase(copy(inst,1,5))= 'EXTRN') Then Begin inst := inst + ':'; upisilabelu(trim(copy(inst, 6, pos(':', inst) - 6)), - 1, lextrn, d32); inst := ''; End; If (uppercase(copy(inst, 1, 6) ) = 'PUBLIC') Or uppercase(copy(inst, 1, 3)) = 'END') Then Begin If prolaz = 2 Then writeln(izlazlab, inst); inst := ''; End; If inst <> '' Then Begin patstr := ''; outst := GenerateHexInstruction( inst, opt); If outst = '' Then Begin Writeln('Greska u liniji ', inst) End Else If outst <> 'XX' Then Begin pozicija[actseg] := pozicija[actseg] + (length(outst) div 2); If(prolaz=2)and(patstr<>'') Then writeln(izlazpat, patstr); UpisiIzlaz(outst); End; End End; prolaz := prolaz + 1; End; For i := 1 To brlabela Do With labele[i] Do writeln(izlazlab, labime, ' ',Ord(labtip),' ', labval, ' ',Ord(labdsize)); Close(ulaz); Close(izlazcode); Close(izlazdata); Close(izlazstack); Close(izlazlab); Close(izlazpat);End;

Begin readopcodetable; Glavni;End.

Page 172: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

172

18. PRAVLJENJE STANDARDNOG OBJ FORMATA

Mašinski kod generisan asemblerom iz prethodnog poglavlja je upotrebljiv za situacije kada se piše novi operativnisistem ili kada se koristi vrlo jednostavan operativni sistem kao što su CP/M ili MS DOS.

Moćniji operativni sistemi imaju znatno složeniju strukturu izvršnog programa. Složeni projekti zahtijevaju da seprogrami sastoje iz više izvornih datoteka koje se separatno kompajliraju i zatim spajaju u jedinstveni izvršni format.

18.1. Objektni formati

Objektni modul je izlaz iz asemblera ili kompajlera. Njegove primarne komponente su mašinski kod i podaci kojeprocesor može da razumije.

Za operativni sistem Windows koriste se dva standarda (sa svojim varijacijama) od kojih oba imaju istu ekstenzijuOBJ. Jedan od ovih standarda je COFF (korišten u Microsoftovim kompajlerima) a drugi je OMF (korišten na šesnaestobitnimoperativnim sistemima, ali i sa Borlandovim kompajlerima na tridesetdvobitnim verzijama Windowsa). COFF format se javljau dvije podvarijante, Microsoftov i GNU.

18.2. Objektni format Microsoft COFF

COFF objektni format razvijen je u okviru besplatnog GNU C kompajlera, a koristi ga i Microsoft u svojimkompajlerima za C, uz malu razliku u metodi relokacije koda. Osobina formata je da se njegov sadržaj dijeli na sekcije kojesluže za grupisanje koda i podataka. Pored sekcija, u objektnoj datoteci postoje razne tabele (simbola, relokacije i linijskihbrojeva). Struktura ovog formata data na slici Sl. 18.2.1:

Struktura Lokacija? NamjenaZaglavlje datoteke Početak datoteke Opis datoteke, podaci o drugim sekcijamaOpciono zaglavlje Odmah iza zaglavlja datoteke Za EXE datoteke, pozicija inicijalnog

programskog brojačaZaglavlje sekcije Iza opcionog zaglavlja èija je

veličina navedena u zaglavlju Lokacija i veličina sekcija koda, podataka ispecijalne namjene

Podaci sekcije Navedeni u zaglavlju sekcije Sadrži kod i podatke programaSekcijske direktive Navedeno u zaglavlju sekcije Sadrži informacije o popravkama potrebne

prilikom relociranja sekcijeLinijski brojevi Navedeno u zaglavlju sekcije Čuva sve linijske brojeve, potrebno debageruTabela simbola Navedeno u zaglavlju datoteke Za svaki simbol (varijable, potprogrami) čuva se

po jedno mjestoTabela stringova Iza tabele simbola Imena simbola koja su duža od 8 bajtova. Prva

èetiri bajta su dužina tabele.Sl. 18.2.1. Struktura COFF OBJ datoteke

18.3. Zaglavlje COFF OBJ datoteke

TFileHeader= Record Machine:word; { 014C (i386) } NumberOfSections: word; { 0003 } TimeDateStamp: LongInt; { 41543009 -> Fri Sep 24 16:32:41 2004 } PointerToSymbolTable: LongInt; NumberOfSymbols:LongInt; SizeOfOptionalHeader:word; Characteristics:word; end;

Ova struktura je uvijek na početku datoteke. Njeni elementi su

Machine – Magični broj. Ova konstanta mora biti jednaka 0x14C i ona služi za raspoznavanje ovog formata.

NumberOfSections – Koliko ima sekcija i samim tim sekcijskih zaglavlja. Konvertor u OBJ koji se razvija u ovompoglavlju ima tri sekcije, .text, .data i .drectve

TimeDateStamp -Vrijeme i datum datoteke

PointerToSymbolTable – Pozicija u datoteci poèetka tabele simbola

NumberOfSymbols - Broj simbola u tabeli simbola.

SizeOfOptionalHeader – Veličina opcionog zaglavlja. OBJ koji se generiše u ovom programu nema opcionozaglavlje, pa će ovaj parametar biti jednak nuli

Page 173: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

173Characteristics - flag bits

Ovi flegovi definišu dodatno značenje zaglavlja:

Bit Oznaka Značenje

$0001 F_RELFLG Ako je postavljen tada nema relokacijskih informacija. Najèešæe se relokacijskeinformacije ukljuèuju u OBJ, a ne u EXE.

$0002 F_EXEC Ako je postavljen, znaèi da nema nerazriješenih simbola i da se može smatratiizvršnim programom

$0004 F_LNNO Ako je postavljen datoteka nema linijskih brojeva

$0008 F_LSYMS Ako je postavljen, datoteka nema lokalnih simbola

$0100 F_AR32WR Ako je postavljen, znaèi da je format Little Endian

18.4. Opciono zaglavlje

Opciono zaglavlje se nalazi odmah iza glavnog zaglavlja. Ono se javlja samo u EXE programima. Njegova svrha jeda definiše ulaznu taèku u program. Kako ovaj konvertor generiše samo OBJ, opcionog zaglavlja nema.TOptionalFileHeader= Record MagicWord:word; { Type of file } Vstamp: word; { Version } TSize: LongInt; { Text size in bytes } DSize: LongInt; { Initialized data size in bytes } BSize: LongInt; { Uninitialized data size in bytes } Entry: LongInt; { Entry point } Text_Start: LongInt; { Base of text used for this file } Data_Start: LongInt; { Base of text used for this file }end;

Ako ima opcionog zaglavlja, samo dva polja su bitna

MagicWord – Magični broj, uvijek ZMAGIC (0x010b).

Entry – Ulazna tačka: Inicijalna pozicija programskog brojaèa (EIP)

18.5. Zaglavlje coff sekcijeTSection=Record Name:array[0..7] of char; { section name in ASC II .text .data ili .drectve } PhysicalAddress:Longint; { size mapped into me mory } VirtualAddress:Longint; { memory address relati ve to image base } SizeOfRawData:Longint; { physical size, multipl e of file alignment } PointerToRawData:Longint; { file offset } PointerToRelocations:LongInt; { offset of reloc ation entries } PointerToLinenumbers:LongInt; { offset of line number entries } NumberOfRelocations:word; { number of relocatio n entries } NumberOfLinenumbers:word; { number of line numb er entries } Characteristics:Cardinal; { $20 = text, $40 = d ata, $80 = bss, $200 = no-load, $800 = don't link, $10 000000 = shared, $20000000 = execute, $ 40000000 = read, $80000000 = write } end;

Ova struktura se nalazi neposredno iza opcionalnog zaglavlja u COFF datoteci (ili iza zaglavlja datoteke akoopcionalnog zaglavlja nema). Znaèenja polja su:

Name – Ime sekcije, ne smije biti duže od osam znakova i završava se nulom. Ako je taèno osam znakova tada nemakrajnje nule. Ako je kraæe od osam znakova, ostali se popunjavaju nulama.

PhysicalAddress – Fizička adresa sekcije. To je adresa gdje će se sekcija učitati u memoriju. Za linkovane izvršneprograme, to je apsolutna adresa u programskom podruèju. Za nepovezane objekte, ova adresa je relativna u odnosu na adresniprostor objekta, to jest prva sekcija je uvijen na adresi nula.

VirtualAddress - Virtualna adresa sekcije, nula ili jednaka PhysicalAddress

SizeOfRawData – Veličina sekcije. Broj bajtova podataka smještenih u datoteku za ovu sekciju. Ovdje nisu uraèunaterelokacione tabele i linijski brojevi, nego samo čisti kod odnosno podaci.

PointerToRawData – Pokazivaè na podatke sekcije. Sadrži poziciju poèetka sekcije u datoteci.

PointerToRelocations - Pozicija relokacijske tabele u datoteci

Page 174: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

174PointerToLineNumbers -Pozicija linijskih brojeva

NumberOfRelocations - Broj elemenata relokacijske tabele. Pažnja: ovaj broj je ogranièen na 65535

NumberOfLineNumbers - Broj elemenata tabele linijskih brojeva. Pažnja: ovaj broj je ogranièen na 65535

Characteristics - flag bits. Ovi flegovi daju dodatne informacije za svaku sekciju.

$0020 STYP_TEXT Ako je postavljen, sekcija sadrži samo izvršni kod

$0040 STYP_DATA Ako je postavljen, sekcija sadrži samo inicijalizirane podatke

$0080 STYP_BSS Ako je postavljen, sekcija sadrži samo neincijalizirane podatke i nema dijela sa podacima uCOFF datoteci

Microsoftovi kompajleri smještaju mašinski kod u sekciju .text, a podatke u sekciju .data. Ova imena nemaju posebnoznačenje osim kao napomena za namjeru upotrebe date sekcije. Drugi kompajleri imaju drugačija imena za svoje sekcije.Sekcije imaju sličnosti sa segmentima koji su korišteni pod MS DOSom ili Windowsom 3.1. Imena najčešće korištenih sekcijadata su na slici:

.text Machine code instructions.

.data Initialized data.

.rdata Read only data. OLE GUIDs are stored here, among other things.

.rsrc Resources. Produced by the resource compiler, and placed into RES files. Linker copies

it to the executable..reloc Base relocations. Produced by the linker. Not found in OBJs..edata The exported function table. Created by the linker and placed in an EXP file. Linker

copies it to the executable..idata Imported function table in an executable file..idata$XXX Portions of an imported function table. The librarian creates these sections in an

import library. The linker combines them into the final .idata section in the executable..CRT Tables of initialization and shutdown pointers in the executable that are used by the

Microsoft C++ runtime library..CRT$XXX Initialization and shutdown pointers in OBJs, prior to the linker combining them in the

executable..bss Uninitialized data..drectve OBJ file section containing linker directives. Not copied to executable.

.debug$XXX

COFF symbol table information in an OBJ file.

Sl. 18.5.1. Standardne sekcije u OBJ i EXE datotekama

18.6. Relokacijska sekcija

TRelocationTable=record r_vaddr:Longint; { address of relocation } r_symndx:Longint; { symbol we're adjusting for } r_type:Longint; { type of relocation } end;

Veličina ove strukture nije djeljiva sa četiri, pa treba biti oprezan prilikom njenog upisa u datoteku. Normalno sepojavljuju dva tipa relokacija:

RELOC_ADDR32 6 Relociraj 32-bitnu apsolutnu referencu

RELOC_REL32 20 Relociraj a 32-bitnu relativnu referencu

Za svaku relokaciju mora se odrediti nova adresa relociranog simbola koji se prilagođava. Ako je simbol drugi objekt(eksterni), tabela će sadržati referencu na taj eksterni simbol i relokacija æe se odnositi na njega. Ako je simbol u istomobjektu, tabela simbola će sadržati elemente koji se odnose na same sekcije (uvijek prisutni i uvijek privatni). Kada se relocirasama sekcija, ovi simboli će prikazati njihovu novu lokaciju.

Page 175: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

175

1. RELOC_ADDR32

Da se izvrši ova relokacija, moraju se izvesti sljedeæi koraci:

• Uzeti adresu simbola na koji se referiše

• Dodati vrijednost koja se trenutno nalazi na toj lokaciji

• Upisati vrijednost nazad

2. RELOC_REL32

Ova relokacija se dešava samo u izvršivim programima i odnosi se samo na eksterne simbole. Za realizaciju overelokacije, moraju se obaviti sljedeći koraci:

• Uzeti adresu simbola na koji se referiše

• Dodati vrijednost koja se trenutno nalazi na toj lokaciji

• Oduzeti adresu poèetka sekcije

• Pridodati originalnu adresu poèetka ove sekcije (normalno je ona 0, pošto su .text sekcija obièno na poèetku, asamo kod njih postoji ovaj vid relokacije)

• Upisati vrijednost nazad

18.7. COFF: Linijski brojevi

TlineNumbers=Record e:record case Boolean of true: (l_symndx: Longint); { function name symbol index } false: (l_paddr:Longint); { address of lin e number } end; l_lnno:word; { line number }end;

Izvršne sekcije mogu da imaju linijske brojeve, koji su korisni za debagere. Linijski brojevi, međutim, neće bitiobrađeni u konvertoru jer informacija o brojevima linija programa u FILDZAN-32 nije bila ugraðena u asemblersku datoteku.

18.8. COFF: Tabela simbola

TSymbolTable=record e:record case Boolean of true: (e_name:Array[0..7] of char); false: (e1:record e_zeroes:Longint; e_offset:Longint; end); end; e_value:Longint; e_scnum:Word; e_type:Word; e_sclass:Byte; e_numaux:Byte; end;

Tabela simbola je najkompleksniji dio objektne COFF datoteke, jer ima mnogo tipova simbola. Tabela simbola imaulaze za sve simbole i metasimbole, ukljuèujuæi javne, statičke eksterne, sekcijske i debagerske simbole.

e.e_name – Ugniježdeno ime simbola

Ako je ime simbola manje ili jednako od 8 znakova, ono se smješta u ovo polje. Ime dugaèko taèno osam znakova sene završava nulom. Treba primijetiti da se ovo polje memorijski preklapa sa poljem e_zeroes i e_offset

e.e.e_zeroes - flag to tell if name is inlined

Ako je e_zeroes jednak nuli, ime je duže od osam znakova i nalazi se u tabeli stringova.

e.e.e_offset - offset of name in string table

Ako je e_zeroes jednak nuli, ovo polje sadrži položaj imena simbola u tabeli stringova.

e_value – Vrijednost simbola. Na primjer, ako simbol predstavlja funkciju, ovdje je data adresa funkcije. Značenjeove vrijednosti zavisi od tipa simbola (ispod)

Page 176: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

176e_scnum – Broj sekcije

Broj sekcije kojoj pripada ovaj simbol. Prva sekcija u tabeli sekcija je sekcija br. 1. Pored ovoga, e_scnum može imatii sljedeće vrijednosti:

N_UNDEF 0 An undefined (extern) symbolN_ABS -1 An absolute symbol (e_value is a constant, n ot an address)N_DEBUG -2 A debugging symbol

e_type – Tip simbola. Ovaj tip simbola je sastavljen od baznog i izvedenog tipa. Na primjer, "pointer to int" je"pointer to T" i "int".

Type Bits MeaningT_NULL ---- 0000 No symbolT_VOID ---- 0001 void function argument (not used)T_CHAR ---- 0010 characterT_SHORT ---- 0011 short integerT_INT ---- 0100 integerT_LONG ---- 0101 long integerT_FLOAT ---- 0110 floating pointT_DOUBLE ---- 0111 double precision floatT_STRUCT ---- 1000 structureT_UNION ---- 1001 unionT_ENUM ---- 1010 enumerationT_MOE ---- 1011 member of enumerationT_UCHAR ---- 1100 unsigned characterT_USHORT ---- 1101 unsigned shortT_UINT ---- 1110 unsigned integerT_ULONG ---- 1111 unsigned longT_LNGDBL ---1 0000 long double (special case bit pa ttern)DT_NON --00 ---- No derived typeDT_PTR --01 ---- pointer to TDT_FCN --10 ---- function returning TDT_ARY --11 ---- array of T

e_sclass – Klasa smještaja

Ovo polje označava gdje se simbol nalazi i šta predstavlja

Class Value MeaningC_NULL 0 No entryC_AUTO 1 Automatic variableC_EXT 2 External (public) symbol - this covers glob als and externsC_STAT 3 static (private) symbolC_REG 4 register variableC_EXTDEF 5 External definitionC_LABEL 6 labelC_ULABEL 7 undefined labelC_MOS 8 member of structureC_ARG 9 function argumentC_STRTAG 10 structure tagC_MOU 11 member of unionC_UNTAG 12 union tagC_TPDEF 13 type definitionC_USTATIC 14 undefined staticC_ENTAG 15 enumaration tagC_MOE 16 member of enumerationC_REGPARM 17 register parameterC_FIELD 18 bit fieldC_AUTOARG 19 auto argumentC_LASTENT 20 dummy entry (end of block)C_BLOCK 100 ".bb" or ".eb" - beginning or end of bl ockC_FCN 101 ".bf" or ".ef" - beginning or end of func tionC_EOS 102 end of structureC_FILE 103 file nameC_LINE 104 line number, reformatted as symbolC_ALIAS 105 duplicate tagC_HIDDEN 106 ext symbol in dmert public libC_EFCN 255 physical end of function

e_numaux – Broj pomoćnih elemenata.

Uz svaki simbol se mogu pridodati dodatni podaci koji se takođe nalaze u tabeli simbola. Za većinu simbola ovajelement je 0. Ipak, kod nekih simbola (npr. ime datoteke) dodatni podaci mogu slijediti i oni se tada preklapaju sa uobičajenimpoljima tabele simbola.

18.9. COFF: Tabela stringova

Tabela stringova sadrži imena stringova koja su prevelika da stanu u tabelu simbola. Tabela je organizovana tako dana samom početku se nalaze četiri bajta koja predstavljaju njenu dužinu. Nakon toga redom slijede sami stringovi završeniznakom 0.

Page 177: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

177

18.10. Program konvertor

Nakon što je objašnjena struktura COFF formata slijedi razvoj konvertora. Asembler je generisao program, podatke,labele, popravke i stek (koji se ne koristi u generatoru OBJ) u posebnim datotekama. Datoteke sa programom i podacima semogu direktno iskopirati u objektnu datoteku, dok je za uključivanje labela u popravki potrebna konverzija formata.

Prema redoslijedu koji zahtijeva COFF obje format, kao i potrebnim dobivanjem jednih podataka iz drugih, programtreba da uradi sljedeće:

• Učita veličinu datoteka sa kodom i podacima (procedura ReadSizes)

• Napuni tabelu simbola, (Procedura LoadLabels) iz datoteke sa ekstenzijom .LAB. Pored ovoga se generišusimboli .file, .text, .data i .drectve, koji imaju pomoćne simbole. U pomoćnom simbolu iza simbola .file sesmještaju ime datoteke s izvornim kodom, a u ostala tri početak istoimenog segmenta. Prilikom punjenja ovetabele se puni i tabela stringova za sva imena koja su duža od 8 znakova.

• Učita tabelu relokacije. (Procedure LoadRelocs) Iz datoteke sa ekstenzijom .PAT se učitaju oni elementi kojizadovoljavaju koji zadovoljavaju jedan od sljedećih uslova:

a) Da su u pitanju apsolutne relokacije podataka ili koda (tipovi ‘D’ i ‘A’ unutar .PAT datoteke), što se daljerealizuje relokacijskim tipom RELOC_ADDR32

b) Da su u pitanju relativne relokacije koda, a da je riječ o eksternim simbolima (tip ‘R’ unutar .PAT datoteke), štose dalje realizuje relokacijskim tipom RELOC_REL32

• Otvori datoteku sa OBJ ekstenzijom (Procedura OpenOutObj)

• U Obj datoteku upiše zaglavlje u koje je u međuvremenu upisan broj elemenata u svim tabelama (ProceduraWriteObjHeader)

• Generišu se i upišu u OBJ zaglavlja sekcija (WriteSectionHeaders)

• Generiše se .text sekcija (CopyCodeSection) iz .COD datoteke, prebacivši cijeli sadržaj .COD datoteke

• Upiše se u OBJ relokacijska tabela (WriteRelocations)

• Generiše se .data sekcija (CopyDataSection) iz .DAT datoteke, prebacivši cijeli sadržaj .DAT datoteke

• Generiše se .drectve sekcije (WriteStartupSection) upisivanjem imena labele koja je bila navedena iza podatkaEND u tabeli labela.

• Upišu se u izlaznu datoteku svi simboli iz tabele simbola (WriteSymbols)

• Upiše se tabela stringova, pazeći da prva četiri bajta budu njena dužina (WriteStringTable)

• Zatvori se objektna datoteka

• Eventualno obrišu datoteke sa ekstenzijama .COD, .DAT, .LAB, .STA i .PAT jer više nisu potrebne.

18.11. Upotreba programa konvertora

Prevedeni program sa naredbom asem (npr. Asem primjer7.asm ) se prevede dalje programom konvertorom COFF,čiji je izvorni kod dat u prilogu. Na primjer:

Coff primjer7

Nakon ovoga se dobija OBJ datoteka, koja se može propustiti kroz mnoge linker programe (isprobano sa linkerimaLINK, GOLINK i ALINK), povezati sa bibliotekama i dobiti EXE program.

Za vježbu je moguće integrisati ovaj konvertor sa asemblerom, tako da se pomoćne datoteke ne generišu ili bar nevide direktno.

18.12. Rezime poglavlja

Ovim korakom je projekt razvoja programskog jezika postao slobodan od tuđeg asemblera. Sljedeći zadatak je vlastitilinker.

Korišten je jedan od standardnih objektnih formata, COFF. Ovaj format se sastoji od zaglavlja, sekcija i dodatnihtabela. Zahvaljujući pogodnoj strukturi izlaznih datoteka asemblera, izgradnja konvertora formata u standardni objektni formatje prilično pravolinijski zadatak.

Page 178: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

178

LISTING GENERATORA STANDARDNOG OBJFORMATA

program Coff;uses sysutils;const relocationentrysize=10; symbolentrysize=18;Type{ Na pocetku fajla ide FileHeader } TFileHeader= Record Machine:word; { 014C (i386) } NumberOfSections: word; { 0003 } TimeDateStamp: LongInt; { 41543009 -> Fri Sep 24 16:32:41 2004 } PointerToSymbolTable: LongInt; NumberOfSymbols:LongInt; SizeOfOptionalHeader:word; Characteristics:word; end;

{ Odmah nakon slijede opisi sekcija n puta} TSection=Record Name:array[0..7] of char; { section name in ASCII } PhysicalAddress:Longint; { size mapped into memory } VirtualAddress:Longint; { memory address relative to image base } SizeOfRawData:Longint; { physical size, multiple of file alignment} PointerToRawData:Longint; { file offset } PointerToRelocations:LongInt; { offset of relocation entries } PointerToLinenumbers:LongInt; { offset of line number entries } NumberOfRelocations:word; { number of relocation entries } NumberOfLinenumbers:word; { number of line number entries } Characteristics:Cardinal; end;{ zatim same sekcije nakon svake sekcije njena relokaciona tabela patabela simbola } TRelocationTable=record r_vaddr:Longint; { address of relocation } r_symndx:Longint; { symbol we're adjusting for } r_type:Longint; { type of relocation } end;

TSymbolTable=record e:record case Boolean of true: (e_name:Array[0..7] of char); false: (e1:record e_zeroes:Longint; e_offset:Longint; end); end; e_value:Longint; e_scnum:Word; e_type:Word; e_sclass:Byte; e_numaux:Byte; end;

{ U .drectve sekciji se nalazi -entry:ULAZ }

var FileHeader:TFileHeader; genname:String; infile:text; SymbolTable:Array[1..10000] of TSymbolTable; StringTable:Array[1..10000] of char; PublicTable:Array[1..1000] of String; Sections:Array[1..3] of TSection; RelocationTable:Array[1..10000] of TRelocationTable; TotSym,StringTabLen,TotRelocs,TotPublic,datahelpsympos,codehelpsympos, drectvehelpsympos:Longint; CodeSize,DataSize:Longint; drectve:string; outobj:file;function trim(st:string):String;begin while (st<>'') and (st[1]=' ') do st:=copy(st,2,length(st)); while (st<>'') and (st[length(st)]=' ') do st:=copy(st,1,length(st)-1); TRIM:=ST;end;

procedure izdvoji(var st,x:string; sep:char);var p:Integer;begin if st='' then begin x:=''; exit end; p:=pos(sep,st); if p>0 then begin x:=trim(copy(st,1,p-1)); st:=TRIM(copy(st,p+1,length(st)-p));

end else begin if sep=':' then x:='' else begin x:=trim(st); st:=''; end endend;Procedure NewSymbol(LabIme:string);var i:integer;begin TotSym:=TotSym+1; with SymbolTable[TotSym] do begin if length(labime)>8 then begin e.e1.E_zeroes:=0; e.e1.e_offset:=StringTabLen+4; for i:=1 to length(labime) do begin StringTabLen:=StringTabLen+1; StringTable[StringTabLen]:=LabIme[i]; end; end else begin for i:=1 to length(labime) do begin e.e_name[i-1]:=LabIme[i]; end; end; endend;Procedure NewPublic(PubIme:string);begin TotPublic:=TotPublic+1; PublicTable[TotPublic]:=Pubime+#0;end;

function IsPublicSymbol(Simbol:String):Boolean;var i:integer;begin IsPublicSymbol:=false; for i:=1 to TotPublic do begin if PublicTable[TotPublic]=Simbol then begin IsPublicSymbol:=true; exit; end end;end;procedure LoadLabels;var st,labime,labtip,labval,labdsize,entry,publicsym:String; i:integer;begin entry:=''; AssignFile(infile,genname+'.lab'); Reset(infile); TotSym:=0; StringTabLen:=0; NewSymbol('.file'); with SymbolTable[TotSym] do begin e_scnum:=65535; e_type:=0; e_value:=0; e_sclass:=$67; e_numaux:=1; end; NewSymbol('h.asm'); with SymbolTable[TotSym] do begin e_scnum:=0; e_type:=0; e_value:=0; e_sclass:=0; e_numaux:=0; end; NewSymbol('@comp.id'); with SymbolTable[TotSym] do begin e_scnum:=65535; e_type:=0; e_value:=$001220FC; e_sclass:=3; e_numaux:=0; end; NewSymbol('.text'); with SymbolTable[TotSym] do begin e_scnum:=1; e_type:=0; e_value:=0; e_sclass:=3; e_numaux:=1; end; NewSymbol('.texhlp'); codehelpsympos:=totsym; NewSymbol('.data'); with SymbolTable[TotSym] do begin e_scnum:=2; e_type:=0; e_value:=0;

Page 179: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

179 e_sclass:=3; e_numaux:=1; end; NewSymbol('.dathlp'); datahelpsympos:=totsym;

drectve:=''; while not eof(infile) do begin readln(infile,st); if (pos('END ',st)>0) then begin entry:=copy(st,5,length(st)); drectve:='-entry:'+entry+' '#0; end else if (pos('PUBLIC ',st)=0) then begin st:=st+';'; izdvoji(st,labime,' '); labime:=labime+#0; izdvoji(st,labtip,' ');

izdvoji(st,labval,' '); izdvoji(st,labdsize,';');

if (Labtip='3') or (labime=entry+#0) or (ispublicsymbol(labime)) then labime:='_'+labime; NewSymbol(labime); with SymbolTable[TotSym] do begin val(labval,e_value,i); e_numaux:=0; if Labtip='0' {lEqu} then begin e_scnum:=65534; e_sclass:=1; end; if Labtip='1' {lProg} then begin e_scnum:=1; e_sclass:=3; end; if Labtip='2' {lData} then begin e_scnum:=2; e_sclass:=3; end; if Labtip='3' {lExtrn} then begin e_scnum:=0; e_value:=0; e_sclass:=2; end; if labime='_'+entry+#0 then begin e_sclass:=2; end; if LabDsize='0' {8 bit} then e_type:=$2; if LabDsize='1' {16 bit} then e_type:=$3; if LabDsize='2' {32 bit} then e_type:=$20; if LabDsize='3' {64 bit} then e_type:=$6; if LabDsize='4' {80 bit} then e_type:=$7; end; end else begin publicsym:=copy(st,7,length(st)); NewPublic(publicsym); end; end; NewSymbol('.drectve'); with SymbolTable[TotSym] do begin e_scnum:=3; e_type:=0; e_value:=0; e_sclass:=3; e_numaux:=1; end; NewSymbol('.datahlp'); drectvehelpsympos:=totsym; close(infile);end;

procedure LoadRelocs;var st,labime,labimeunder,position,relkind:String; i,rez:integer; p1:pchar; posvalint:Longint;label dalje;begin AssignFile(infile,genname+'.pat'); Reset(infile); TotRelocs:=0; while not eof(infile) do begin readln(infile,st); st:=st+';'; izdvoji(st,labime,' '); labime:=labime+#0; labimeunder:='_'+labime; izdvoji(st,position,' '); izdvoji(st,relkind,';'); labime:=copy(labime,1,length(labime)); for i:=1 to TotSym do begin if SymbolTable[i].e.e1.E_zeroes=0 then p1:=Addr(StringTable[SymbolTable[i].e.e1.e_offset-3]) else p1:=Addr(SymbolTable[i].e.e_name[0]); if (strcomp(addr(labime[1]),p1)=0) or (strcomp(addr(labimeunder[1]),p1)= 0) then begin rez:=i-1; goto dalje; end;

end; rez:=0; dalje: if rez<>0 then begin val(position,posvalint,i); if (RelKind='R') and (SymbolTable[rez+1].e_scnum=0) then begin TotRelocs:=TotRelocs+1; RelocationTable[TotRelocs].r_vaddr:=posvalint; RelocationTable[TotRelocs].r_symndx:=rez; RelocationTable[TotRelocs].r_type:=20; end; if (RelKind='A') then begin TotRelocs:=TotRelocs+1; RelocationTable[TotRelocs].r_vaddr:=posvalint; RelocationTable[TotRelocs].r_symndx:=rez; RelocationTable[TotRelocs].r_type:=6; end; if (RelKind='D') then begin TotRelocs:=TotRelocs+1; RelocationTable[TotRelocs].r_vaddr:=posvalint; RelocationTable[TotRelocs].r_symndx:=rez; RelocationTable[TotRelocs].r_type:=6; end end; end; close(infile);end;procedure ReadSizes;var f: file of Byte;begin Assign(f,genname+'.cod'); Reset(f); CodeSize:=FileSize(f); Close(f); Assign(f,genname+'.dat'); Reset(f); DataSize:=FileSize(f); Close(f);end;

procedure FillSectionHeaders;Var SetName:String; i:Integer;begin

with SymbolTable[codehelpsympos] do begin e.e1.e_zeroes:=CodeSize; e.e1.e_offset:=TotRelocs; end; with SymbolTable[datahelpsympos] do begin e.e1.e_zeroes:=DataSize; e.e1.e_offset:=0; end; with SymbolTable[drectvehelpsympos] do begin e.e1.e_zeroes:=Length(drectve)-1; e.e1.e_offset:=0; end;

With Sections[1] do begin SetName:='.text'#0; for i:=1 to length(setname) do Name[i-1]:=setname[i]; PhysicalAddress:=0; VirtualAddress:=0; SizeOfRawData:=CodeSize; PointerToRawData:=sizeof(TfileHeader)+3*sizeof(TSection); PointerToRelocations:=PointerToRawData+CodeSize; PointerToLinenumbers:=0; NumberOfRelocations:=TotRelocs; NumberOfLinenumbers:=0; Characteristics:=$60500020; end; With Sections[2] do begin SetName:='.data'#0; for i:=1 to length(setname) do Name[i-1]:=setname[i]; PhysicalAddress:=CodeSize; VirtualAddress:=0; SizeOfRawData:=DataSize; PointerToRawData:=Sections[1].PointerToRelocations+ TotRelocs* relocationentrysize ; PointerToRelocations:=0; PointerToLinenumbers:=0; NumberOfRelocations:=0; NumberOfLinenumbers:=0; Characteristics:=$C0500040; end; With Sections[3] do begin SetName:='.drectve'#0; for i:=1 to length(setname) do Name[i-1]:=setname[i]; PhysicalAddress:=CodeSize+DataSize; VirtualAddress:=0; SizeOfRawData:=length(drectve)-1; PointerToRawData:=Sections[2].PointerToRawData+DataSize; PointerToRelocations:=0; PointerToLinenumbers:=0; NumberOfRelocations:=0; NumberOfLinenumbers:=0; Characteristics:=$00000A00; end;

end;

procedure FillObjHeader;begin with FileHeader do begin

Page 180: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

180 Machine:=$014C; NumberOfSections:=3; TimeDateStamp:=0; PointerToSymbolTable:=sections[3]. PointerToRawData+length(drectve); NumberOfSymbols:=totsym; SizeOfOptionalHeader:=0; Characteristics:=0; end;end;

procedure OpenOutObj;begin Assign(outobj,genname+'.obj'); Rewrite(outobj,1);end;procedure writeobjheader;begin BlockWrite(outobj,FileHeader,sizeof(TFileHeader));end;procedure writesectionheaders;begin BlockWrite(outobj,sections[1],sizeof(TSection)); BlockWrite(outobj,sections[2],sizeof(TSection)); BlockWrite(outobj,sections[3],sizeof(TSection));end;

procedure copycodesection;var f: file of Byte; b: Byte;begin Assign(f,genname+'.cod'); Reset(f); while not(eof(f)) do begin Read(f,b); BlockWrite(outobj,b,1) end; Close(f);end;

procedure writerelocations;var i:integer;begin for i:=1 to TotRelocs do begin BlockWrite(outobj,RelocationTable[i],relocationentrysize); end;end;

procedure copydatasection;var f: file of Byte; b: Byte;begin Assign(f,genname+'.dat'); Reset(f); while not(eof(f)) do begin Read(f,b); BlockWrite(outobj,b,1)

end; Close(f);end;

procedure writestartupsection;begin BlockWrite(outobj,drectve[1],length(drectve));end;

procedure writesymbols;var i:integer;begin for i:=1 to TotSym do begin BlockWrite(outobj,SymbolTable[i],symbolentrysize); end;end;procedure writestringtable;var s:Longint;begin s:=stringtablen+4; BlockWrite(outobj,s,4); BlockWrite(outobj,stringtable,StringTabLen);end;procedure DeleteTempFiles; procedure erase1(fn:string); var f:file; begin assignfile(f,fn); erase(f); end;begin erase1(genname+'.cod'); erase1(genname+'.dat'); erase1(genname+'.sta'); erase1(genname+'.lab'); erase1(genname+'.pat');end;

begin genname:=paramstr(1); ReadSizes; loadlabels; loadrelocs; fillsectionheaders; fillobjheader; openoutobj; writeobjheader; writesectionheaders; copycodesection; writerelocations; copydatasection; writestartupsection; writesymbols; writestringtable; close(outobj); if not(paramstr(2)='/k') then deletetempfiles;end.

Page 181: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

181

19. LINKER

Posljednji korak za dobivanje izvršnog programa je pokretanje linkera. U ovom poglavlju se neće razvijati vlastitilinker, ali će se ući u to šta linker generalno radi.

19.1. Princip rada linkera

Linkerov zadatak je da spoji OBJ datoteke u jedinstvenu izvršnu datoteku. Ipak, kada bi stvari bile tako jednostavnelinker bi bio obični program koji spaja gomile podataka. Komplikovani dio linkera je posao fiksiranja, o čemu će biti riječikasnije. Kao i asembler i linker obavlja zadatak u dva prolaza. U prvom prolazu linker sastavi skup pravila za povezivanje, a udrugom primjenjujući ta pravila upisuje izvršnu datoteku.

Linker treba da stavi sav kod i podatke iz svake OBJ datoteke u izvršnu datoteku. Ako se linkeru proslijede tri OBJdatoteke tada se kod i podaci iz sve tri OBJ datoteke smješta u EXE. Ali to se ne radi prostim lijepljenjem OBJ datoteka jednena kraj druge. Umjesto toga linker spaja sve sekcije sa istim imenom u jedinstvenu. Na primjer, tri OBJ datoteke od kojihsvaka ima jednu .text sekciju će se povezati u jedinstveni EXE sa jednom .text sekcijom, koja se sastoji od tri individualne .textsekcije kakve su bile u OBJ datoteci.

Jedinstvena sekcija se formira spajanjem istoimenih sekcija u redoslijedu kako je proslijeđeno kroz parametre linkeru.Ako su linkeru proslijeđeni parametri

A.OBJ B.OBJ C.OBJ

Linker će spojiti ove OBJ datoteke kao što je prikazano na slici Sl. 19.1.1. U promjeru sa slile se uočava da svesekcije sa istim imenom se spajaju u jedinstvene sekcije _text i _data, dok sesekcije sa jedinstvenim imenom smještaju po redu.

Sekcije koje u svom imenu imaju znak $ predstavljaju izuzetak. Kodovih sekcija se ignoriše dio imena iza znaka $ kao i sam ovaj znak. Na primjer,mogu postojati sekcija sa imenima info$a, info$b i info$other. Sve one će sespojiti u jedinstvenu sekciju sa imenom info.

Pored pravila sa znakom $, standardni prioritet redoslijeda sekcija sepodešava označavajući ih specijalnim atributima. Sekcije sa atributom koda sesmještaju prve u izvršni program, zatim slijede sekcije sa neinicijaliziranimpodacima (ako ih ima, a koji se smještaju u .bss sekciju), sekcije sainicijaliziranim podacima (uključujući .data sekcija), zatim sekcije generisanelinkerom kao što je .reloc. Obično se na kraj EXE programa smješta .debugsekcija, jer se ona ne mora uvijek učitavati.

Sekcije sa atributima LINK_REMOVE i LINK_INFO, a koje se zovu.drectve se ne ugrađuju u EXE program. One se koriste da se proslijedeparametri linkeru

Sl. 19.1.1. Primjer spajanja sekcija u OBJ

19.2. Fiksiranja i relokacije

Zašto kompajler prosto ne generiše izvršnu datoteku direktno iz izvorne, eliminišući potrebu za linkerom? Iako ima itakvih kompajlera, glavni razlog je što se većina programa ne sastoji od jedne datoteke sa izvornim kodom. Kompajleri suspecijalizovani za preuzimanje jedne datoteke sa izvornim kodom proizvodeći sirovi ekvivalent u mašinskom kodu. Poštoizvorna datoteka može imati reference na kod ili podatke izvan izvorne datoteke, kompajler ne može generisati egzaktno pravikod koji poziva tu funkciju ili pristupa toj varijabli. Umjesto toga, kompajler uključuje dodatne informacije u izlaznu datotekukoja opisuje spoljni kod ili podatke. Te informacije se zovu popravke, jer je kod kojim se pristupa eksternim funkcijama ivarijablama nekorektan i mora se popraviti kasnije.

Neka na primjer treba pozvati podprogram naredbom

CALL PODPROGRAM

Asembler će na ovom mjestu, ako se podprogram ne nalazi u istoj datoteci sa izvornim kodom, generisati mašinskikod:

E8 00 00 00 00

Očigledno, E8 je kod instrukcije CALL, a ove četiri nule su adresa potprograma. Očigledno je da podprogram nećebiti udaljen 0 bajtova od naredbe CALL. Ovaj dio koda je neispravan i mora se popraviti.

Page 182: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

182U datom primjeru, linker sada zamjenjuje ova četiri bajta iza CALL naredbe korektnom adresom potprograma. On će

znati da ih treba zamijeniti preko informacije iz sloga popravki. Korektnu adresu saznaje sam linker spajajući sekcije.

Postoje tri vrste slogova popravki.

Popravka REL32 znači da nova adresa treba da se upiše relativno od adrese na kojoj se vrši popravka. U primjeru saCALL naredbom treba zamijeniti ove četiri nule popravkom REL32. Ukoliko su se ove nule nalazile na adresi 1000, a nakonspajanja modula PODPROGRAM upadne na adresu 2530, umjesto nula upisuje se 1530. Podprogram se dakle poziva sarelativnom adresom i na taj način je omogućena relokatibilnost. Ovaj tip popravke se ne upisuje u izvršnu datoteku.

Popravka DIR32 je predviđena za popravku apsolutnih adresa. Pogledati sljedeći primjer.

MOV EAX,VRIJEDNOST

VRIJEDNOST DD 43332

Neka se labela VRIJEDNOST nalazi na adresi 00002E03

Asembler će prevesti prvu instrukciju u apsolutnu adresiranje, npr. B8 03 2E 00 00. Učita li se program na adresu00600000, i instrukcija MOV EAX se mora mijenjati, na primjer u B8 03 2E 40 00 jer je labela VRIJEDNOST sada na adresi00602E03.

Nova vrijednost koju linker upiše nakon DIR32 popravke jednaka je zbiru podrazumijevane startne adrese programa iprethodne vrijednosti koja se nalazila na adresi koja se popravlja. Podrazumijevana startna adresa je 00400000h, pa linker trebau našem slučaju da primjeni sabiranje konstanti 00400000h i 00002E03h i upiše adresu 00402E03h. Windowsov loader će,ukoliko postoji .reloc sekcija, obaviti ovaj zadatak još jednom, ali samo ako se program učitava na nepodrazumijevanu adresu.Tada se za svaki DIR32 slog sabira vrijednost na adresi koju popravljamo sa razlikom između podrazumijevane i stvarneadrese gdje je program učitan.

Treći tip popravke DIR32NB (Direct 32, No Base), se koristi za debagerske informacije. Ova popravka se razlikujeod DIR32 što ne sadrži podrazumijevanu adresu učitavanja izvršnog programa.

19.3. Biblioteke

Često je potrebno spojiti više OBJ datoteka u jedinstvenu datoteku koja se zatim prosljeđuje linkeru. Tipični primjerje izvršna biblioteka jezika C++, koja se zove LIBC.LIB. U njoj se nalazi mnogo OBJ datoteka koje obavljaju funkcije kao štosu printf, sin, atoi ili fopen.

Biblioteke se sastoje od zaglavlja biblioteke i zatim kopija OBJ datoteka koje su ugrađene u biblioteku.

Za razliku od OBJ datoteka direktno proslijeđenih linkeru kroz parametre, linker ne mora uključiti u EXE programsve OBJ datoteke ugrađene u biblioteku. OBJ datoteke unutar biblioteke će biti ugrađene samo ako se koristi bar jednavarijabla ili podprogram iz njih. Ako program iz objektne datoteke koja se uključuje EXE poziva neki podprogram, npr. printf,i linker pronađe objektnu datoteku unutar biblioteke u kojoj se nalazi podprogram printf, ta datoteka se ugrađuje u EXE. Ali nesamo ona. Neka printf dalje poziva putchar koji je u svojoj OBJ datoteci, a putchar opet poziva checkvideomode koji je utrećoj OBJ datoteci. Tada će sve tri OBJ datoteke biti uključene u EXE.

Specijalna grupa biblioteka su importne biblioteke. Strukturalno, one se ne razlikuju od regularnih biblioteka, niti ihlinker razlikuje kada razrješava simbole. Ključna razlika je u tome što importne biblioteke nisu nastale iz izvornog koda i OBJdatoteka proizvedenih od njega. Importne biblioteke pravi linker prilikom povezivanja drugog EXE, odnosno DLL programa.Ove biblioteke se baziraju na importnim tabelama.

19.4. Pravljenje importne tabele

Jedna od najznačajnijih osobina 32 bitnog Windows-a je mogućnost importa funkcija iz drugih EXE i DLL programa.Sve ove informacije o uključenim DLL nalaze se u importnoj tabeli. Importna tabela se obično smješta u sekciju .idata.

Izgleda neobično da linker u stvari ne brine da li se pozvani podprogram nalazi unutar EXEa ili u spoljašnjem DLLu.Prostim praćenjem pravila spajanja sekcija i razrješavanja simbola linker pravi importnu tabelu, neinformisan o specijalnomznačenju ove tabele.

1121 public symbols

EA14 _ActivateKeyboardLayout@8 ... Archive member name at EA14: USER32.dll/ ...

Page 183: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

183 SECTION HEADER #2 .text name RAW DATA #2 00000000 FF 25 00 00 00 00 .%.... ... SECTION HEADER #4 .idata$5 name RAW DATA #4 00000000 00 00 00 00 .... ... SECTION HEADER #5 .idata$4 name RAW DATA #5 00000000 00 00 00 00 .... ... SECTION HEADER #6 .idata$6 name RAW DATA #6 00000000 00 00 41 63 74 69 76 61 | 74 65 4B 65 79 62 6F 61 ..Activa|teKeyboa 00000010 72 64 4C 61 79 6F 75 74 | 00 00 rdLayout|.. ... COFF SYMBOL TABLE ... 003 00000000 SECT2 notype () External | _ActivateKeyboardLayout@8

Pogleda li se dio importne biblioteke USER32.LIB na gornjoj slici može se zaključiti kako linker obrađuje importnedatoteke. Neka je pozvana API funkcija ActivateKeyboardLayout. Slog popravke za _ActivateKeyboardLayout@8 se nalaziOBJ datoteci korisničkog programa. U zaglavlju biblioteke USER32.LIB linker zaključuje da se ova funkcija nalazi u OBJdatoteci na poziciji 0xEA14. Time se linkeru da do znanja da se ova OBJ biblioteka uključi u EXE. A u njoj ima više sekcija,kao što su .text, .idata$5, .idata$4, and .idata$6. U .text sekciji je JMP instrukcija (FF 25 00 00 00 00). Iz COFF tabele simbolase vidi da se _ActivateKeyboardLayout@8 nalaz na početku druge sekcije, a to znači da će poziv CALL_ActivateKeyboardLayout@8 rezultovati JMP instrukcijom

Treba primijetiti da sekcije .idata$4, .idata$5 i .idata$6 sadrže podatke za importnu tabelu. Koristeći pravilo da sesekcije čije ime sadrži znak $ grupišu u jedinstvene sekcije sa imenom koje se nalazi prije znaka $, importna tabela se generišeredovnim poslom linkera.

19.5. Kreiranje eksportne tabele

Pored kreiranja importnih tabela za izvršne programe, linker je odgovoran i za obrnuti zadatak, eksportne tabele.Ovdje je zadatak linkera istovremeno lakši i teži. U prvom prolazu, linker sakuplja informacije o svim eksportovanimsimbolima i kreira tabelu eksportovanih funkcija. To se sekciju .edata posebne OBJ datoteke koja je preimenovana uekstenziju EXP iako je po strukturi standardna OBJ datoteka.

U drugom prolazu se EXP ugradi u EXE kao i svaka standardna OBJ datoteka, mada mnogi linkeri spajaju sekcije.rdata i .edata.

19.6. Drugi zadaci linkera

Pored navedenog, linkeri ubacuju informacije potrebne za debager, kreiranje MAP datoteka koje daju informaciju otome šta je uključeno u izvršni program te dodavanje programčića koji se starta ako je EXE pokrenut iz MS DOSa. Ali, ovonisu obavezni zadaci jednog linkera, nego više korisne pomoćne funkcije. O projektu razvoja linkera vidjetihttp://www.iecc.com/linker/

19.7. Rezime poglavlja

Linker je alatka koja povezuje više prevedenih jedinica u funkcionalni izvršni program. Njegov ključni zadatak jespajanje sekcija, a drugi je razrješavanje referenci (popravke) između kombinovanih sekcija. Više OBJ datoteka se povezuju ubiblioteke. Biblioteke koje ne sadrže kod, nego samo informacije o adresama unutar EXE ili DLL se zovu importne biblioteke.Da bi se napravile importne datoteke koriste se importne i eksportne tabele.

Page 184: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

184

20. INTERPRETER

Drugi popularni koncept za realizaciju viših programskih jezika, pored kompajlera su interpreteri. U ovom poglavljuće biti opisan jedan od načina pravljenja interpretera

20.1. Interpreteri i jezici za njihov razvoj

Iako se mnogi interpreteri pišu u asembleru radi što veće brzine rada, interpretere je, za razliku od kompajlera,moguće pisati potpuno u višem programskom jeziku i bez ikakvog znanja o arhitekturi mašine na kojoj se interpreter izvršava.Pored ovoga, za pisanjem vlastitog interpretera potreba je češća nego za pisanjem vlastitog kompajlera, jer je u mnogimaplikacijama potrebno dodati neki skriptni jezik.

20.2. Interpretirani jezik

U ovom primjeru implementirati će se interpreter vrlo primitivne verzije BASICa. Ova verzija ima 26 cjelobrojnihvarijabli pod imenom a,b,c ... , z. Naredbe su

PRINT <izraz> prikaz aritmetičkog izraza

LET <varijabla> = <izraz> dodjela vrijednosti varijabli

INPUT <varijabla> unošenje vrijednosti varijable

LIST prikaz cijelog programa

IF <izraz1> THEN <izraz2> skok na liniju <izraz2> ako je <izraz1> različit od 0

GOTO <izraz> bezuslovni skok

END kraj programa ili izlazak iz interpretera

Kao u klasičnom, danas pomalo zaboravljenom, BASICu, naredbe se mogu izvršiti direktno kucanjem ili se isprednaredbe može staviti linijski broj kada se ona smješta u program.

20.3. Linijski editor

Prvo je potrebno realizovati smještanje linija programa. Da bi interpreter bio što jednostavniji, program se čuva u nizuod 1000 stringova. Naravno da je ovo najneracionalniji način, i da bi trebalo ići na dinamičke strukture podataka, ali bi i listinginterpretera tada bio veći.

Linije (kojima se radi lakše interpretacije dodaje simbol ';') se unose Pascal-skom naredbom readln (ili se uzimaju izniza linija) i, kada se linija unese, provjerava se da li ona počinje cifrom. Ako linija počinje cifrom , prepozna se linijski broj itekst linije bez linijskog broja se smjesti u navedeni element niza stringova koji odgovara liniji sa tim linijskim brojem. Akolinija ne počinje cifrom, prelazi se u analizu naredbe i njeno izvršavanje. Nakon toga je interpreter spreman za izvršenje iliunos nove naredbe.

20.4. Interpreterska petlja

Interpreter, dakle, ima dva režima rada, komandni i programski. U komandnom režimu rada naredba se očitava prekoreadln , a u programskom režimu iz niza stringova o kome su naredbe. Nakon dohvaćene naredbe slijedi njeno prepoznavanjei izvršenje, a zatim se u programskom režimu rada traži sljedeća instrukcija. Ako je prethodna instrukcija bila instrukcijaGOTO ili IF, naredna instrukcija je navedena kao argument ove instrukcije. U ostalim slučajevima, to je prva naredna nepraznainstrukcija, što se traži uvećanjem broja trenutne instrukcije (varijabla izvrlinija) za jedan, sve dok se ne dođe do naredbe kojanije prazna ili dok se ne dostigne linija 1000. Glavna interpreterska petlja izgleda ovako:

procedure Glavni;var brlinije:integer;begin quit:=false; repeat if inprogram then linija:=naredbe[izvrlinija] else readln(linija); linija:=uppercase(linija); gr:=false; linija:=linija+';'; pozicija:=0; novi; if znak in ['0'..'9'] then begin

brlinije:=uzmikonstantu; if (brlinije>0) and (brlinije<1000) then begin linija:=trim(copy( linija,pozicija, length(linija))); if linija=';' then linija:=''; naredbe[brlinije]:=linija; end end else begin if slijedi('PRINT')then DoPrint else if slijedi('LIST') then Dolist else if slijedi('GOTO') then DoGoto else if slijedi('LET') then DoLet else if slijedi('IF') then DoIf else

if slijedi('INPUT')then DoInput else if slijedi('END') then DoEnd else Greska('Nepoznata naredba'); end; if inprogram then begin if not skok then repeat izvrlinija:=izvrlinija+1; until (izvrlinija>=1000) or (naredbe[izvrlinija]<>''); if izvrlinija=1000 then inprogram:=false; skok:=false; end; until quit;end;

Page 185: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

18520.5. Realizacija aritmetičkih izraza

Dosta znanja iz pisanja kompajlera se može primijeniti na pisanje interpretera. Glavna razlika je što umjestogenerisanog koda koji izlazi kao listing treba simulirati izvršenje odgovarajućih naredbi. Tako na primjer, u trećoj verzijikompajlera dio koda koji je realizovao jezički pojam Clan izgledao je ovako

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX');

Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX');

Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

Emitovanje mašinskih naredbi treba zamijeniti procedurama koje rade ekvivalentnu stvar, pa će u interpreteruprocedura Clan izgledati ovako:

procedure Clan;var z: char;begin Faktor; if gr then exit; while (znak in ['*', '/', '%']) do begin z := znak; push(eax); if gr then exit; Novi; if gr then exit; Faktor; if gr then exit;

case z of '*': begin ebx:=pop; eax:=eax*ebx; end; '/', '%': begin ebx:=eax; eax:=pop; if ebx<>0 then begin if z = '%' then eax:=eax mod ebx

else eax:=eax div ebx end else Greska('Dijeljenje snulom'); end; end; end;end;

Kao što se vidi, iako se uočava razlika što postoje varijable eax i ebx , i procedure push i pop koje rade sasimuliranim stekom, struktura procedure je ista. Umjesto generisanih asemblerskih naredbi koje rade ekvivalentan efekat,izvršavaju se adekvatne operacija nad varijablama eax i ebx.

Pošto u interpreteru greška ne smije izazvati prekid rada samog interpretera nego samo interpretiranog programa,nakon svakog potprograma se provjerava da li je izazvana greška naredbom

if gr then exit;

dok sama procedura Greska nema naredbe halt koja izaziva prekid rada. Ova procedura treba da pored ispisa tekstaporuke i da postavi varijablu gr na tačnu vrijednost.

Za simuliranje steka, baš kao kod mašinskog steka, i ovdje se koristi sp kao oznaka trenutne pozicije na steku.Funkcija pop i procedura push izgledaju ovako:

function pop:integer;begin pop:=0; if gr then exit; if (sp<=0) or (sp>100) then begin Greska('Izraz'); pop:=0; end else begin pop:=stek[sp]; sp:=sp-1; end;end;

procedure push(n:integer);begin if gr then exit; if (sp<0) or (sp>=100) then begin Greska('Izraz'); end else begin sp:=sp+1; stek[sp]:=n; end;end;

I kod ostalih procedura za izračunavanje izraza vidi se sličnost sa istoimenim procedurama iz treće verzijekompajlera. U cilju skraćenja koda, izbačen je pojam IzrazDodjeljivanja, a operatori >,< i = prebačeni na isti prioritet kao isabiranje i oduzimanje.

Varijable su predstavljene nizom od 26 cijelih brojeva. Pristup pojedinoj varijabli se svodi na proračun pozicije u nizuna osnovu imena varijable, a zatim se očitava odgovarajući element niza.

20.6. Realizacija naredbi primitivnog BASICa

Zahvaljujući činjenici da prevedeni program napisan u Pascalu već ima sve potrebne rutine, realizacija samih naredbije trivijalna. Tako se naredba print realizuje kao

Page 186: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

186procedure DoPrint;begin Novi; if gr then exit; Izraz; if gr then exit; writeln(eax);end;

Procedurom Novi se pređe na sljedeći znak ulazne linije. Procedurom Izraz se izračuna aritmetički izraz i njegovrezultat dobije u varijabli eax.

Analogno se dobijaju realizacije ostalih naredbi, što se može vidjeti u kompletnom programu

20.7. Instrukcije za dohvatanje simbola

Funkcije novi, slijedi i idido su preuzete iz koda korištenog u trećoj verziji kompajlera, a zatim pojednostavljene jer jeinterpreter linijski orijentisan. Tako u proceduri Novi nema potrebe prelaziti u sljedeću liniju, nego se sve provjere vrše unutarjedne linije, kao u sljedećoj implementaciji ove procedure.

procedure Novi;begin if gr then exit; repeat pozicija := pozicija + 1; if pozicija > Length(linija) then Greska('Preko kraja linije') else znak:=linija[pozicija]; until (pozicija>Length(linija)) or (znak<>' ');end;

Dodane su i procedure Uppercase i Trim za pretvaranje malih slova u velika odnosno izbacivanje blankova izstringova.

20.8. Listing interpretera primitivnog BASICa

Slijedi kompletan listing ovog interpretera:

program Interpreter;var linija: string; pozicija,izvrlinija:integer; naredbe: Array [1..1000] of string; varijable:Array [0..25] of integer; znak:char; stek:array[0..100] of integer; sp,eax,ebx:integer; inprogram,quit,skok,gr:Boolean;function trim(st:string):String;begin while (st<>'') and (st[1]=' ') do st:=copy(st,2,length(st)); while (st<>'') and (st[length(st)]=' ') do st:=copy(st,1,length(st)-1); TRIM:=ST;end;

function uppercase(st:string):String;var i:integer;begin for i:=1 to length(st) do if (st[i]>='a') and (st[i]<='z') then st[i]:=chr(ord(st[i])-32); uppercase:=st;end;

procedure Greska(poruka: string);begin if inprogram then Writeln(poruka,' u liniji ', izvrlinija) else WriteLn(poruka); inprogram:=false; gr:=true; sp:=0;end;

function pop:integer;begin pop:=0; if gr then exit; if (sp<=0) or (sp>100) then begin Greska('Izraz'); pop:=0; end else begin pop:=stek[sp]; sp:=sp-1; end;

end;

procedure push(n:integer);begin if gr then exit; if (sp<0) or (sp>=100) then begin Greska('Izraz'); end else begin sp:=sp+1; stek[sp]:=n; end;end;

procedure Novi;begin if gr then exit; repeat pozicija := pozicija + 1; if pozicija > Length(linija) then Greska('Preko kraja linije') else znak:=linija[pozicija]; until (pozicija>Length(linija)) or(znak<>' ');end;

procedure IdiDo(z: char);begin if gr then exit; if (znak <> z) then Greska('Ocekivano' + z); Novi; if gr then exit;end;

function Slijedi(ocekivano: string):Boolean;begin SLijedi:=false; if gr then exit; if (copy(linija,pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija +Length(ocekivano) - 1; end else Slijedi := false;end;

function UzmiKonstantu: integer;var rezultat: integer;

begin UzmiKonstantu:=0; if gr then exit; rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); Novi; if gr then exit; end; if (znak = ' ') or (znak = '`') then Novi; if gr then exit; UzmiKonstantu := rezultat;end;

procedure Varijabla;var rezultat: integer;begin if gr then exit; rezultat := (ord(znak) - ord('A')); eax:=varijable[rezultat]; ebx:=rezultat; Novi; if gr then exit;end;procedure Izraz;forward;procedure Faktor;var rezultat: integer;begin case znak of '-': begin Novi; if gr then exit; Faktor; if gr then exit; eax:=-eax; end; '~': begin Novi; if gr then exit; Faktor; if gr then exit; eax:=not(eax); end; '!': begin Novi; if gr then exit; Faktor; if gr then exit; if eax=0 then eax:=1; end; '0'..'9': begin rezultat := UzmiKonstantu; eax:=rezultat; end; '(': begin Novi; if gr then exit;

Page 187: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

187 Izraz; if gr then exit; IdiDo(')'); if gr then exit; end; 'A'..'Z': begin Varijabla; if gr then exit; end else Greska('Izraz'); end;end;

procedure Clan;var z: char;begin Faktor; if gr then exit; while (znak in ['*', '/', '%']) do begin z := znak; push(eax); if gr then exit; Novi; if gr then exit; Faktor; if gr then exit; case z of '*': begin ebx:=pop; eax:=eax*ebx; end; '/', '%': begin ebx:=eax; eax:=pop; if ebx<>0 then begin if z = '%' then eax:=eax mod ebx else eax:=eax div ebx end else Greska('Dijeljenje snulom'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-', '&', '|','^','>','<','=']) do begin push(eax); z := znak; Novi; if gr then exit; Clan; if gr then exit; case z of '+': begin ebx:=pop; eax:=eax+ebx; end; '=': begin ebx:=pop; if eax=ebx then eax:=1 else eax:=0; end; '>': begin ebx:=pop; if ebx>eax then eax:=1 else eax:=0; end; '<': begin ebx:=pop; if ebx<eax then eax:=1 else eax:=0; end;

'-': begin

ebx:=eax; eax:=pop; eax:=eax-ebx; end; '&': begin ebx:=pop; eax:=eax and ebx; end; '|': begin ebx:=pop; eax:=eax or ebx; end; '^': begin ebx:=pop; eax:=eax xor ebx; end; end; end;end;

procedure DoPrint;begin Novi; if gr then exit; Izraz; if gr then exit; writeln(eax);end;

procedure DoGoto;begin novi; if gr then exit; Izraz; if gr then exit; izvrlinija:=eax; inprogram:=true; skok:=true;end;

procedure DoLet;var dodvar:char;begin Novi; if gr then exit; dodvar:=znak; if dodvar in ['A'..'Z'] then begin Novi; if gr then exit; IdiDo('='); if gr then exit; izraz; varijable[ord(dodvar)- ord('A')]:=eax; end else Greska('Varijabla');end;

procedure DoInput;var unizraz:string; dodvar:Char;begin Novi; if gr then exit; dodvar:=znak; if dodvar in ['A'..'Z'] then begin write('?'); readln(unizraz); if gr then exit; linija:=unizraz+';'; pozicija:=0; Novi; if gr then exit; Izraz; if gr then exit; varijable[ord(dodvar)- ord('A')]:=eax; end else Greska('Varijabla');end;

procedure DoIf;begin Novi; if gr then exit; Izraz; if gr then exit; if eax<>0 then begin if not(slijedi('then')) then

Greska ('Then'); if gr then exit; Novi; if gr then exit; Izraz; if gr then exit; IzvrLinija:=eax; skok:=true; end;end;

procedure doEnd;begin if inprogram then inprogram:=false else quit:=trueend;

procedure DoList;var i:integer;begin for i:=1 to 1000 do if naredbe[i]<>'' then writeln(i,'',copy(naredbe[i],1, length(naredbe[i])-1));end;

procedure Glavni;var brlinije:integer;begin quit:=false; repeat if inprogram then linija:=naredbe[izvrlinija] else readln(linija); linija:=uppercase(linija); gr:=false; linija:=linija+';'; pozicija:=0; novi; if znak in ['0'..'9'] then begin brlinije:=uzmikonstantu; if (brlinije>0) and (brlinije<1000) then begin linija:=trim(copy( linija,pozicija, length(linija))); if linija=';' then linija:=''; naredbe[brlinije]:=linija; end end else begin if slijedi('PRINT')then DoPrint else if slijedi('LIST') then Dolist else if slijedi('GOTO') then DoGoto else if slijedi('LET') then DoLet else if slijedi('IF') then DoIf else if slijedi('INPUT')then DoInput else if slijedi('END') then DoEnd else Greska('Nepoznata naredba'); end; if inprogram then begin if not skok then repeat izvrlinija:=izvrlinija+1; until (izvrlinija>=1000) or (naredbe[izvrlinija]<>''); if izvrlinija=1000 then inprogram:=false; skok:=false; end; until quit;end;

begin Glavniend.

20.9. Rezime poglavlja

Pisanje interpretera može biti jednostavniji zadatak od pisanja kompajlera, jer se interpreter može napisati bez znanjamašinskog jezika. Umjesto generisanja koda, naredbe se izvršavaju simulirajući odgovarajući asemblerski kod. U ovompoglavlju realizovana je primitivna verzija BASICa, ali dobiveni program može biti polazna osnova za dalje proširenje jezika

Page 188: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

188

21. SADRŽAJ

1. VRSTE SISTEMSKOG SOFTVERA...............................................................................................................................3

1.1. SISTEMSKI SOFTVER..........................................................................................................................................................31.2. SISTEMSKI SOFTVER ZA KONTROLU IZVRŠENJA PROGRAMA..............................................................................................31.3. SOFTVER ZA KORISNIČKO OKRUŽENJE ..............................................................................................................................31.4. RAZVOJNI ALATI ...............................................................................................................................................................31.5. POMOĆNE ALATKE ............................................................................................................................................................41.6. REZIME POGLAVLJA..........................................................................................................................................................4

2. PROCESOR I OPERATIVNI SISTEM ZA KOJE SE GENERIŠE KÔD ...................................................................5

2.1. REGISTRI...........................................................................................................................................................................52.2. ADRESNI REŽIMI ...............................................................................................................................................................52.3. INSTRUKCIJE.....................................................................................................................................................................52.4. OPERATIVNI SISTEM..........................................................................................................................................................62.5. REZIME POGLAVLJA..........................................................................................................................................................6

3. UOBIČAJENI PRISTUPI U RAZVOJU KOMPAJLERA ............................................................................................7

3.1. ITERATIVNI PRISTUP..........................................................................................................................................................73.2. PRIMJENA GENERATORA KODA.........................................................................................................................................73.3. ANALIZA GOTOVOG KOMPAJLERA ....................................................................................................................................73.4. CRENSHAW-OVA NETEHNIČKA METODA ...........................................................................................................................83.5. WATERFALL I SPIRALNI PRISTUP RAZVOJU INFORMACIONIH SISTEMA...............................................................................83.6. PROGRAMSKI JEZIK U KOME SE RAZVIJA KOMPAJLER........................................................................................................93.7. HARDVERSKO I SOFTVERSKO OKRUŽENJE ZA KOJE SE RAZVIJA KOMPAJLER .....................................................................93.8. REZIME POGLAVLJA..........................................................................................................................................................9

4. PROSTI ARITMETI ČKI IZRAZI .................................................................................................................................10

4.1. STRUKTURA TIPIČNIH ARITMETIČKIH IZRAZA .................................................................................................................104.2. SINTAKSNA ANALIZA ARITMETI ČKIH IZRAZA ..................................................................................................................114.3. GENERISANJE KODA ZA RAČUNANJE ARITMETIČKE IZRAZE.............................................................................................114.4. PRVA VERZIJA KOMPAJLERA...........................................................................................................................................124.5. TESTNI PRIMJER..............................................................................................................................................................134.6. REZIME POGLAVLJA........................................................................................................................................................14

5. PREVOĐENJE IZ DATOTEKA, BLOKOVI, VIŠECIFRENI BROJEVI............. .................................................15

5.1. FORMAT INSTRUKCIJA ....................................................................................................................................................155.2. BLOKOVI .........................................................................................................................................................................155.3. MODIFIKACIJE PROCEDURA KOMPAJLERA ZBOG PREVOĐENJA IZ DATOTEKE..................................................................155.4. MODIFIKACIJE KOMPAJLERA ZBOG GENERISANJA DATOTEKA SA ASEMBLERSKIM KODOM..............................................165.5. PROŠIRENJA ARITMETIČKIH IZRAZA ................................................................................................................................165.6. TESTNI PRIMJER..............................................................................................................................................................175.7. REZIME POGLAVLJA........................................................................................................................................................19

6. VARIJABLE, RELACIONI OPERATORI, USLOVI, PETLJE... ..............................................................................20

6.1. PROŠIRENJE ARITMETIČKIH IZRAZA ................................................................................................................................206.2. USLOVI ...........................................................................................................................................................................226.3. PETLJE............................................................................................................................................................................236.4. GENERALIZOVANI JEZIČKI POJAM BLOK..........................................................................................................................246.5. TESTNI PRIMJER..............................................................................................................................................................256.6. REZIME POGLAVLJA........................................................................................................................................................25

7. KLJUČNE RIJEČI, STRINGOVI, DINAMIČKI NIZOVI I FUNKCIJE..................................................................27

7.1. KLJUČNE RIJEČI ..............................................................................................................................................................277.2. KOMENTARI I NEIGNORISANJE SIMBOLA.........................................................................................................................277.3. MODIFIKACIJA USLOVA I PETLJI......................................................................................................................................287.4. MODIFIKACIJE ARITMETIČKIH IZRAZA I UVOĐENJE STRINGOVA ......................................................................................287.5. FUNKCIJE I PROCEDURE..................................................................................................................................................297.6. TESTNI PRIMJER..............................................................................................................................................................317.7. REZIME POGLAVLJA........................................................................................................................................................33

8. DEKLARACIJE VARIJABLI, STANDARDNE FUNKCIJE....... ...............................................................................36

8.1. TABELA IDENTIFIKATORA ...............................................................................................................................................36

Page 189: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

1898.2. TIPOVI ............................................................................................................................................................................378.3. DEKLARISANJE VARIJABLI I NOVA STRUKTURA PROGRAMA............................................................................................378.4. IZRAZI I SEMANTIKA .......................................................................................................................................................388.5. TABLICE GENERISANOG KODA ZA RAZLIČITE OPERANDE ................................................................................................398.6. FUNKCIJE I PROVJERA PARAMETARA...............................................................................................................................438.7. TESTNI PRIMJER..............................................................................................................................................................458.8. REZIME POGLAVLJA........................................................................................................................................................46

9. REALNI BROJEVI ..........................................................................................................................................................51

9.1. KOPROCESOR..................................................................................................................................................................519.2. REALNE KONSTANTE ......................................................................................................................................................519.3. KOMUNIKACIJA IZMEĐU FP STEKA I MEMORIJE..............................................................................................................519.4. ARITMETIČKE OPERACIJE................................................................................................................................................529.5. REALNE VARIJABLE ........................................................................................................................................................539.6. FUNKCIJE REALNOG ARGUMENTA I UNARNI OPERATORI.................................................................................................549.7. TESTNI PRIMJER..............................................................................................................................................................549.8. REZIME POGLAVLJA........................................................................................................................................................55

10. SLOŽENI TIPOVI PODATAKA....................................................................................................................................61

10.1. VIŠEDIMENZIONALNI NIZOVI ......................................................................................................................................6110.2. INDIREKTNI POZIV FUNKCIJE......................................................................................................................................6210.3. SLOGOVI ....................................................................................................................................................................6310.4. TESTNI PRIMJER.........................................................................................................................................................6610.5. REZIME POGLAVLJA ...................................................................................................................................................67

11. PREDPROCESIRANJE I OPTIMIZACIJA KODA ............ ........................................................................................74

11.1. STRUKTURA KOMPAJLERA .........................................................................................................................................7411.2. PREDPROCESORSKA DIREKTIVA #DEFINIRAJ ..............................................................................................................7411.3. DIREKTIVE USLOVNOG KOMPAJLIRANJA....................................................................................................................7411.4. DIREKTIVA #DODAJ ZA UKLJUČIVANJE DATOTEKE.....................................................................................................7511.5. REALIZACIJA PREDPROCESORA..................................................................................................................................7511.6. OPTIMIZACIJA KODA ..................................................................................................................................................7511.7. TESTNI PRIMJER OPTIMIZACIJE...................................................................................................................................7911.8. REZIME POGLAVLJA ...................................................................................................................................................80

12. TESTNI PRIMJERI.........................................................................................................................................................81

12.1. PRIMJER: BAZE PODATAKA I KORISNIČKI INTERFEJS ..................................................................................................8112.2. PRIMJER: MULTIMEDIJA .............................................................................................................................................8312.3. PRIMJER: WEB SERVER..............................................................................................................................................8312.4. PRIMJER: NUMERIČKA ANALIZA ................................................................................................................................8512.5. REZIME POGLAVLJA ...................................................................................................................................................85

13. TEORIJA JEZIKA I PARSIRANJA..............................................................................................................................98

13.1. FORMALNE GRAMATIKE .............................................................................................................................................9813.2. KONTEKSTNO OSJETLJIVA GRAMATIKA......................................................................................................................9813.3. NESAŽIMAJUĆA GRAMATIKA......................................................................................................................................9813.4. KONTEKSTNO SLOBODNA GRAMATIKA ......................................................................................................................9813.5. REGULARNA GRAMATIKA ..........................................................................................................................................9813.6. PARSIRANJE...............................................................................................................................................................9913.7. LL PARSIRANJE.........................................................................................................................................................9913.8. LR PARISRANJE.......................................................................................................................................................10013.9. GENERATORI PARSERA.............................................................................................................................................10213.10. REZIME POGLAVLJA .................................................................................................................................................103

14. OSNOVNI WIN32 API PROGRAM ............................................................................................................................104

14.1. HELLO WORLD ........................................................................................................................................................10414.2. PROSTI PROZOR.......................................................................................................................................................10414.3. KORAK 1: REGISTRACIJA PROZORSKE KLASE...........................................................................................................10514.4. KORAK 2: KREIRANJE PROZORA..............................................................................................................................10514.5. KORAK 3: PETLJA PORUKA......................................................................................................................................10614.6. KORAK 4: PROZORSKA PROCEDURA.........................................................................................................................10614.7. OBRADA PORUKA.....................................................................................................................................................10714.8. ŠTA JE TO PORUKA? .................................................................................................................................................10814.9. KOMUNIKACIJA SA DIALOŠKIM PROZORIMA.............................................................................................................10914.10. ŠTA JE RED ČEKANJA PORUKA?................................................................................................................................109

Page 190: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

19014.11. ŠTA JE PETLJA PORUKA............................................................................................................................................10914.12. REZIME POGLAVLJA .................................................................................................................................................109

15. KORISNIČKI INTERFEJS I GRAFIČKE PRIMITIVE...........................................................................................110

15.1. SERVISNE APLIKACIJE..............................................................................................................................................11015.2. KONZOLNE APLIKACIJE............................................................................................................................................11015.3. GRAFIČKE KONTROLE ..............................................................................................................................................11015.4. FUNKCIJE GRAFIČKIH KONTROLA KROZ PRIMJER......................................................................................................11115.5. MENIJI .....................................................................................................................................................................11415.6. DUGME - BUTTON....................................................................................................................................................11415.7. EDITNA I MEMO POLJA .............................................................................................................................................11515.8. GRUPE KONTROLA I RADIO TASTERI.........................................................................................................................11515.9. KONTROLNE KUĆICE (CHECKBOX) ...........................................................................................................................11615.10. LISTE PODATAKA (LISTBOX) ....................................................................................................................................11615.11. KOMBINOVANE LISTE (COMBO BOX) ........................................................................................................................11615.12. STATIČKI TEKST .......................................................................................................................................................11615.13. KLIZNA TRAKA (SCROLLBAR) ..................................................................................................................................11715.14. ISCRTANE SLIKE I WM_PAINT PORUKA .................................................................................................................11715.15. REZIME POGLAVLJA .................................................................................................................................................118

16. SPISAK WIN32API FUNKCIJA ..................................................................................................................................119

16.1. NAJVAŽNIJI PODSISTEMI WINDOWS API-JA .............................................................................................................11916.2. DLL DATOTEKE U KOJIMA SE NALAZE FUNKCIJE.....................................................................................................12016.3. SPISAK API FUNKCIJA..............................................................................................................................................12016.4. PORTIRANJE WINDOWS API FUNKCIJE.....................................................................................................................15516.5. REZIME POGLAVLJA .................................................................................................................................................157

17. ASEMBLER....................................................................................................................................................................158

17.1. INSTRUKCIJSKI SET PENTIUMA II..............................................................................................................................15817.2. OPERACIONI KODOVI, OPIS.......................................................................................................................................15817.3. OPERANDI................................................................................................................................................................15917.4. KODIRANJE ADRESE: MODR/M AND SIB BYTES.....................................................................................................15917.5. PRIMJERI KODIRANJA KOMPLETNIH INSTRUKCIJA....................................................................................................16017.6. PARSIRANJE INSTRUKCIJE........................................................................................................................................16317.7. PREPOZNAVANJE ADRESNIH REŽIMA ........................................................................................................................16317.8. PRORAČUN MODRM , SIB I DEPLASMANA ................................................................................................................16317.9. PUNJENJE I PRETRAŽIVANJE TABELE INSTRUKCIJA ...................................................................................................16417.10. GENERISANJE HEKSADEKADNOG KODA....................................................................................................................16417.11. NUMERIČKE KONSTANTE .........................................................................................................................................16417.12. PSEUDOINSTRUKCIJE, PREFIKSI I MODIFIKATORI......................................................................................................16417.13. PRVI PROLAZ............................................................................................................................................................16517.14. DRUGI PROLAZ I GENERISANJE KODA.......................................................................................................................16517.15. IZVRŠNA VERZIJA.....................................................................................................................................................16517.16. LISTING ASEMBLERA...............................................................................................................................................166

18. PRAVLJENJE STANDARDNOG OBJ FORMATA..................................................................................................172

18.1. OBJEKTNI FORMATI..................................................................................................................................................17218.2. OBJEKTNI FORMAT MICROSOFT COFF ....................................................................................................................17218.3. ZAGLAVLJE COFF OBJ DATOTEKE .........................................................................................................................17218.4. OPCIONO ZAGLAVLJE...............................................................................................................................................17318.5. ZAGLAVLJE COFF SEKCIJE........................................................................................................................................17318.6. RELOKACIJSKA SEKCIJA...........................................................................................................................................17418.7. COFF: LINIJSKI BROJEVI..........................................................................................................................................17518.8. COFF: TABELA SIMBOLA .........................................................................................................................................17518.9. COFF: TABELA STRINGOVA ....................................................................................................................................17618.10. PROGRAM KONVERTOR............................................................................................................................................17718.11. UPOTREBA PROGRAMA KONVERTORA......................................................................................................................17718.12. REZIME POGLAVLJA .................................................................................................................................................177

19. LINKER ..........................................................................................................................................................................181

19.1. PRINCIP RADA LINKERA ...........................................................................................................................................18119.2. FIKSIRANJA I RELOKACIJE........................................................................................................................................18119.3. BIBLIOTEKE .............................................................................................................................................................18219.4. PRAVLJENJE IMPORTNE TABELE...............................................................................................................................18219.5. KREIRANJE EKSPORTNE TABELE...............................................................................................................................183

Page 191: PROJEKTOVANJE SISTEMSKOG SOFTVERA - …people.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.pdf · 3 1. VRSTE SISTEMSKOG SOFTVERA Prije učenja razvoja sistemskog softvera potrebno

19119.6. DRUGI ZADACI LINKERA ..........................................................................................................................................18319.7. REZIME POGLAVLJA .................................................................................................................................................183

20. INTERPRETER .............................................................................................................................................................184

20.1. INTERPRETERI I JEZICI ZA NJIHOV RAZVOJ................................................................................................................18420.2. INTERPRETIRANI JEZIK.............................................................................................................................................18420.3. LINIJSKI EDITOR.......................................................................................................................................................18420.4. INTERPRETERSKA PETLJA.........................................................................................................................................18420.5. REALIZACIJA ARITMETIČKIH IZRAZA........................................................................................................................18520.6. REALIZACIJA NAREDBI PRIMITIVNOG BASICA ........................................................................................................18520.7. INSTRUKCIJE ZA DOHVATANJE SIMBOLA..................................................................................................................18620.8. LISTING INTERPRETERA PRIMITIVNOG BASICA .......................................................................................................18620.9. REZIME POGLAVLJA .................................................................................................................................................187

21. SADRŽAJ........................................................................................................................................................................188