Skip to content

Commit

Permalink
Use kLIBC and GNU Make
Browse files Browse the repository at this point in the history
    modified:   BitmapHeader.hpp
    modified:   Icon.cpp
    modified:   Icon.hpp
    modified:   IconDir.hpp
    modified:   IconDirEntry.hpp
    modified:   IconImage.hpp
    modified:   IconMgr.cpp
    modified:   IconMgr.hpp
    modified:   IconsVar.cpp
    modified:   IconsVar.hpp
    new file:   Makefile
    new file:   Makefile.common
    modified:   RgbQuad.hpp
    modified:   intro.cpp
    modified:   main.cpp
  • Loading branch information
komh committed Dec 29, 2014
1 parent ebf885d commit e5f0cf2
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/BitmapHeader.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef BITMAP_HEADER_HPP
#define BITMAP_HEADER_HPP

#include <os2.h>

class BitmapHeader{
Expand Down Expand Up @@ -101,4 +104,6 @@ class BitmapHeader{
ULONG getBiClrImportant(){
return biClrImportant;
}
};
};

#endif
5 changes: 5 additions & 0 deletions src/Icon.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include <cstdlib>
#include <cstring>

#include "Icon.hpp"

int Os2Icon::ipow(int b, int e){
int p=b;
while(--e)
Expand Down
7 changes: 7 additions & 0 deletions src/Icon.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#ifndef ICON_HPP
#define ICON_HPP

#define INCL_GPIBITMAPS
#define INCL_GPI
#include <os2.h>

#include "IconsVar.hpp"
#include "IconImage.hpp"

struct IconError{
const char* msg;
const char* function;
Expand Down Expand Up @@ -126,3 +132,4 @@ class Os2Icon20:public Os2Icon{

};

#endif
11 changes: 9 additions & 2 deletions src/IconDir.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#ifndef ICON_DIR_HPP
#define ICON_DIR_HPP

#include "IconDirEntry.hpp"

class IconDir{

USHORT idReserved;
Expand Down Expand Up @@ -25,7 +30,7 @@ class IconDir{
USHORT getIdCount(){
return idCount;
}
vector<IconDirEntry*> getIdEntries(){
std::vector<IconDirEntry*> getIdEntries(){
return idEntries;
}

Expand All @@ -41,6 +46,8 @@ class IconDir{
idCount = valor;
}

vector<IconDirEntry*> idEntries;
std::vector<IconDirEntry*> idEntries;

};

#endif
5 changes: 5 additions & 0 deletions src/IconDirEntry.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef ICON_DIR_ENTRY_HPP
#define ICON_DIR_ENTRY_HPP

class IconDirEntry{
BYTE bWidth;
BYTE bHeight;
Expand Down Expand Up @@ -53,3 +56,5 @@ class IconDirEntry{
return datosImagen;
}
};

#endif
10 changes: 9 additions & 1 deletion src/IconImage.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#ifndef ICON_IMAGE_HPP
#define ICON_IMAGE_HPP

#include "BitmapHeader.hpp"
#include "RgbQuad.hpp"

class IconImage{
public:
IconImage();
Expand Down Expand Up @@ -65,4 +71,6 @@ class IconImage{
PBYTE icAnd;
int numcolores;
int numBytesInImg;
};
};

#endif
6 changes: 6 additions & 0 deletions src/IconMgr.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#include <iostream>

#include "IconMgr.hpp"

using namespace std;

#define ICONO_20X20 20
#define ICONO_40X40 40

Expand Down
14 changes: 10 additions & 4 deletions src/IconMgr.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#ifndef ICON_MGR_HPP
#define ICON_MGR_HPP

#include <vector>
#include <iterator>
#include <algorithm>

using namespace std;
#include "Icon.hpp"
#include "IconDir.hpp"

class IconMgr{
public:
Expand All @@ -12,6 +16,7 @@ class IconMgr{
int identidad;
};

class Os2IconMgr12; // forward declaration

class WiconMgr:public IconMgr{
public:
Expand Down Expand Up @@ -50,7 +55,7 @@ class Os2IconMgr:public IconMgr{
PBYTE centerImageData(PBYTE data, const int tamanio, int bits);
int numImages;
private:
vector<Os2Icon> *listaiconos;
std::vector<Os2Icon> *listaiconos;
};

class Os2IconMgr12:public Os2IconMgr{
Expand All @@ -72,7 +77,7 @@ class Os2IconMgr12:public Os2IconMgr{
void llenaOffSets();
ULONG sizeAllPaletas();
ULONG firstOffSet();
vector<Os2Icon12*> listaImagenes;
std::vector<Os2Icon12*> listaImagenes;
};

class Os2IconMgr20:public Os2IconMgr{
Expand All @@ -84,7 +89,8 @@ class Os2IconMgr20:public Os2IconMgr{
ULONG firstOffSet();
void llenaOffSets();
private:
vector<Os2Icon20> *listaiconos;
std::vector<Os2Icon20> *listaiconos;
int freeIconMem();
};

#endif
2 changes: 2 additions & 0 deletions src/IconsVar.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "IconsVar.hpp"

IconBIH::IconBIH(){
cbFix = 0;
cx = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/IconsVar.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifndef ICONS_VAR_HPP
#define ICONS_VAR_HPP

#define INCL_GPI
#include <os2.h>

class IconBIH{
Expand Down Expand Up @@ -53,3 +57,5 @@ class IconAFH{
USHORT cxDisplay;
USHORT cyDisplay;
};

#endif
125 changes: 125 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#
# Configuration parts of GNU Make/GCC build system.
# Copyright (C) 2014 by KO Myung-Hun <[email protected]>
#
# This file is part of GNU Make/GCC build system.
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.
#

##### Configuration parts that you can modify

# specify sub directories
SUBDIRS :=

# specify gcc compiler flags for all the programs
CFLAGS :=

# specify g++ compiler flags for all the programs
CXXFLAGS := -DOS2EMX_PLAIN_CHAR=1

# specify linker flags such as -L option for all the programs
LDFLAGS :=

# specify dependent libraries such as -l option for all the programs
LDLIBS :=

ifdef RELEASE
# specify flags for release mode
CFLAGS +=
CXXFLAGS +=
LDFLAGS +=
else
# specify flags for debug mode
CFLAGS +=
CXXFLAGS +=
LDFLAGS +=
endif

# specify resource compiler, default is rc if not set
RC :=

# specify resource compiler flags
RCFLAGS :=

# Variables for programs
#
# 1. specify a list of programs without an extension with
#
# BIN_PROGRAMS
#
# Now, assume
#
# BIN_PROGRAMS := program
#
# 2. specify sources for a specific program with
#
# program_SRCS
#
# the above is REQUIRED
#
# 3. specify various OPTIONAL flags for a specific program with
#
# program_CFLAGS for gcc compiler flags
# program_CXXFLAGS for g++ compiler flags
# program_LDFLAGS for linker flags
# program_LDLIBS for dependent libraries
# program_RCSRC for rc source
# program_RCFLAGS for rc flags
# program_DEF for .def file
# program_EXTRADEPS for extra dependencies

BIN_PROGRAMS := winico

winico_SRCS := intro.cpp main.cpp Icon.cpp IconMgr.cpp IconsVar.cpp

# Variables for libraries
#
# 1. specify a list of libraries without an extension with
#
# BIN_LIBRARIES
#
# Now, assume
#
# BIN_PROGRAMS := library
#
# 2. specify sources for a specific library with
#
# library_SRCS
#
# the above is REQUIRED
#
# 3. set library type flags for a specific library to a non-empty value
#
# library_LIB to create a static library
# library_DLL to build a DLL
#
# either of the above SHOULD be SET
#
# 4. specify various OPTIONAL flags for a specific library with
#
# library_CFLAGS for gcc compiler flags
# library_CXXFLAGS for g++ compiler flags
#
# the above is common for LIB and DLL
#
# library_DLLNAME for customized DLL name without an extension
# library_LDFLAGS for linker flags
# library_LDLIBS for dependent libraries
# library_RCSRC for rc source
# library_RCFLAGS for rc flags
# library_DEF for .def file, if not set all the symbols are exported
# library_NO_DEF if set, .def file is not generated automatically
# library_EXTRADEPS for extra dependencies
#
# the above is only for DLL

BIN_LIBRARIES :=

include Makefile.common

# additional stuffs
Loading

0 comments on commit e5f0cf2

Please sign in to comment.