OSDev.org
https://forum.osdev.org/

"tty.h" explanation?
https://forum.osdev.org/viewtopic.php?f=1&t=33112
Page 1 of 1

Author:  RAYG11 [ Sat Aug 11, 2018 7:48 am ]
Post subject:  "tty.h" explanation?

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 :)

Author:  iansjack [ Sat Aug 11, 2018 9:04 am ]
Post subject:  Re: "tty.h" explanation?

The functions are defined in tty.c.

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

Author:  RAYG11 [ Sat Aug 11, 2018 9:10 am ]
Post subject:  Re: "tty.h" explanation?

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

Author:  iansjack [ Sat Aug 11, 2018 9:44 am ]
Post subject:  Re: "tty.h" explanation?

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.

Author:  RAYG11 [ Sat Aug 11, 2018 10:03 am ]
Post subject:  Re: "tty.h" explanation?

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 :)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/