OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Oct 22, 2018 9:06 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: "tty.h" explanation?
PostPosted: Sat Aug 11, 2018 7:48 am 
Offline

Joined: Sat Aug 11, 2018 7:29 am
Posts: 3
Hello
I was having a look at the "Meaty Skeleton" after building a basic cli style OS from the "Bare Bones" source.
I understand almost all of it now apart from "tty.h":
Code:
#ifndef _KERNEL_TTY_H
#define _KERNEL_TTY_H

#include <stddef.h>

void terminal_initialize(void);
void terminal_putchar(char c);
void terminal_write(const char* data, size_t size);
void terminal_writestring(const char* data);

#endif

Where is the source for the four functions defined in "tty.h" located and what does the second line, #define _KERNEL_TTY_H, do?
Thank you in advance :)


Top
 Profile  
 
 Post subject: Re: "tty.h" explanation?
PostPosted: Sat Aug 11, 2018 9:04 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3291
Location: Chichester, UK
The functions are defined in tty.c.

That line is there to prevent the include file from being included more than once.


Top
 Profile  
 
 Post subject: Re: "tty.h" explanation?
PostPosted: Sat Aug 11, 2018 9:10 am 
Offline

Joined: Sat Aug 11, 2018 7:29 am
Posts: 3
iansjack wrote:
The functions are defined in tty.c.

That line is there to prevent the include file from being included more than once.

hello
thank you for the response. any idea where i can find "tty.c"? also do you know what effect "#define _KERNEL_TTY_H" is having?
cheers


Top
 Profile  
 
 Post subject: Re: "tty.h" explanation?
PostPosted: Sat Aug 11, 2018 9:44 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3291
Location: Chichester, UK
If you look at the list of source files you will see "kernel/arch/i386/tty.c".

The #define line is used in conjunction with the #ifndef line. It's a very common construct in C header files. You should perhaps brush up on your knowledge of C and how include files are used before proceeding.


Top
 Profile  
 
 Post subject: Re: "tty.h" explanation?
PostPosted: Sat Aug 11, 2018 10:03 am 
Offline

Joined: Sat Aug 11, 2018 7:29 am
Posts: 3
iansjack wrote:
If you look at the list of source files you will see "kernel/arch/i386/tty.c".

The #define line is used in conjunction with the #ifndef line. It's a very common construct in C header files. You should perhaps brush up on your knowledge of C and how include files are used before proceeding.


i guess so.
thanks anyway :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], ReBootC, thomtl and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group