From cf8707bf2ede99d8543d806355eee088bdc1376b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 6 Aug 2022 01:21:08 +0200 Subject: Use typedefs when interacting with Win32 API. It's not like they're ever going to change the definition of WORD (knock on wood) -- but I guess it's proper to use them as if their definitions might change. --- README | 55 ++++++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) (limited to 'README') diff --git a/README b/README index 4fe5ba0..49be3fd 100644 --- a/README +++ b/README @@ -30,17 +30,24 @@ Frontend ~~~~~~~~ The graphical interface is implemented in C++ using the Win32 API (see the c folder). The source code is spread across a small number of -files. For an overview of the classes/functions provided by each file, -see defs.h. In summary: +files. In summary: main.cpp Entry point and initialization. Contains the main event handler. -listview.cpp Creates and handles the shared aspects of the two list views. -episodelistview.cpp Defines the interface to the episode list view. -datalistview.cpp Defines the interface to the data list view. -pl.cpp Interface to Prolog backend. -common.cpp Some useful functions that don't fit elsewhere. - -In addition, defs.h itself defines a variety of macros and templates. +listview.* Creates and handles the shared aspects of the two list views. +episodelistview.* Defines the interface to the episode list view. +datalistview.* Defines the interface to the data list view. +layout.* Handles the placement of child windows. +pl.* Interface to Prolog backend. +win.* Helpers for interacting with the Win32 API. +wcharptr.* Defines WcharPtr, a class that owns a wchar_t*. +util.h Simple utility functions. +debug.* Helpers for debugging. + +The code operates under the assumption that "raw" pointers are +non-owning -- i.e., their lifetime is managed by somebody else, such +as Windows or Prolog. When strings need to be heap-allocated, like +when converting from a narrow to a wide string, they are put within a +WcharPtr object, which manages the lifetime of the string. Building ~~~~~~~~ @@ -53,33 +60,3 @@ following additional programs are required: To build b/EpisodeBrowser.exe, issue `make' in the root directory of the project. - -Hacking -~~~~~~~ -Following is a summary of some coding conventions used in the project. - - ... TYPES ... - -Here are some general guidelines for choosing what types to use: - -1) Don't use Windows-specific types that "hide" pointers. -2) Where there is a Windows-specific type with the same name and - function as a standard type (e.g., CHAR = char), prefer the - standard type. -3) Otherwise, prefer the Windows-specific type when interacting with - the Windows API. - -For example, prefer... - - - char* over LPSTR - - char const* over LPCSTR - - LVITEM* over LPLVITEM - - int over INT - - DWORD over unsigned long - (but only when interacting with Windows) - -Note... - - - that the second rule above does not apply to BOOL, which should not - be replaced with bool, as BOOL is an integer that may have other - values than 1 and 0. -- cgit v1.2.3