• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdemid
 

libtdemid

  • libtdemid
dattypes.cpp
1/**************************************************************************
2
3 dattypes.cpp - Some always useful definitions and functions
4 This file is part of LibKMid 0.9.5
5 Copyright (C) 1997,98,99,2000 Antonio Larrosa Jimenez
6 LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libtdemid.html
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22
23 Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
24
25***************************************************************************/
26#include "dattypes.h"
27#include <stdio.h>
28
29ushort readShort(FILE *fh)
30{
31 uchar c1;
32 uchar c2;
33
34 fread(&c1,1,1,fh);
35 fread(&c2,1,1,fh);
36 return (c1<<8)|c2;
37}
38
39ulong readLong(FILE *fh)
40{
41 uchar c1;
42 uchar c2;
43 uchar c3;
44 uchar c4;
45 ulong l;
46
47 fread(&c1,1,1,fh);
48 fread(&c2,1,1,fh);
49 fread(&c3,1,1,fh);
50 fread(&c4,1,1,fh);
51 l=((c1<<24)|(c2<<16)|(c3<<8)|c4);
52 return l;
53}
54
55#ifdef DEBUG
56
57void printfdebug(const char *format, int a, int b, int c)
58{
59 char *s=(char *)format;
60 int i=0;
61 while (*s!=0)
62 {
63 if (*s=='%') i++;
64 s++;
65 }
66 switch (i)
67 {
68 case (1) : fprintf(stderr,format,a); break;
69 case (2) : fprintf(stderr,format,a,b); break;
70 case (3) : fprintf(stderr,format,a,b,c); break;
71 default : fprintf(stderr,format); break;
72 }
73
74}
75
76void printfdebug(const char *format, int a, long b)
77{
78 fprintf(stderr,format,a,b);
79}
80
81void printfdebug(const char *format, double a, double b, double c)
82{
83 char *s=(char *)format;
84 int i=0;
85 while (*s!=0)
86 {
87 if (*s=='%') i++;
88 s++;
89 }
90 switch (i)
91 {
92 case (1) : fprintf(stderr,format,a); break;
93 case (2) : fprintf(stderr,format,a,b); break;
94 case (3) : fprintf(stderr,format,a,b,c); break;
95 default : fprintf(stderr,format); break;
96 }
97
98}
99#else
100
101void printfdebug(const char *, int , int , int )
102{
103}
104void printfdebug(const char *, int , long )
105{
106}
107void printfdebug(const char *, double , double , double )
108{
109}
110#endif

libtdemid

Skip menu "libtdemid"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdemid

Skip menu "libtdemid"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for libtdemid by doxygen 1.9.4
This website is maintained by Timothy Pearson.