⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mrmtypes.c

📁 安装DDD之前
💻 C
📖 第 1 页 / 共 2 页
字号:
/** * * $Id: MrmTypes.c,v 1.1 2004/08/28 19:25:46 dannybackx Exp $ * * Copyright (C) 1995 Free Software Foundation, Inc. * Copyright (C) 1995-2001 LessTif Development Team * * This file is part of the GNU LessTif Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * *  Original author:  Geoffrey W. Ritchey *                    codesmit@southwind.net **/#include <LTconfig.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <ctype.h>#include <X11/Xlib.h>#include "FakeWidget.h"#include "glue.h"#include "uil.h"#include "main.h"#include "MrmTypes.h"#if 0static Char8 *Char8Add(Char8 *s1, Char8 *s2){    Char8 *Return = s1;    strcat(Return->lvalue, s2->lvalue);    Return->theExpression.value = (long)Return->lvalue;    return Return;}static intAddrNameGetEvalValue(AddrName *this){    ExpressionElement *t = ExpressionListFind(&LocalSymbolTable,					  (char *)(this->theExpression.value));    if (NULL == t)    {	t = ExpressionListFind(&GlobalSymbolTable,			       (char *)this->theExpression.value);    }    if (NULL == t)    {	__MrmExit(LOC,	     "Can't find %s in Symbol Tables\n", this->theExpression.value);    }    if (!ExpressionElementIsType(t, MrmRtypeInteger))    {	yyerror("Illegal type in expression");    }    return (int)ExpressionElementGetValue(t);}#endifvoidInheritItemEmit(InheritItem *this){    fputc(this->theExpression.type, outFile);    fwrite((char *)this->theExpression.value, 1,	   strlen((char *)this->theExpression.value), outFile);    fputc(0, outFile);}InheritItem *InheritItemNew(char *s){    InheritItem *this = (InheritItem *)malloc(sizeof(InheritItem));    strcpy(this->lvalue, s);    this->theExpression.value = (long)this->lvalue;    this->theExpression.type = MrmRtypeCountedVector;    this->theExpression.Emit = (PFI)InheritItemEmit;    return this;}FontSet *FontSetNew(void){    FontSet *this = (FontSet *) malloc(sizeof(FontSet));    this->theExpression.type = MrmRtypeFontSet;    this->theExpression.value = (long)&this->fontset;    this->fontset.DirectionRtoL = 0;    this->fontset.WideChar = 0;    this->fontset.name = NULL;    return this;}#if 0static char *FontSetGetName(FontSet * this){    return (this->fontset.name);}#endifstatic voidFontSetEmit(FontSet * this){    fputc(this->theExpression.type, outFile);    fwrite(this->fontset.name, 1, strlen(this->fontset.name), outFile);    fputc(0, outFile);    fwrite(&this->fontset.DirectionRtoL, sizeof(this->fontset.DirectionRtoL),	   1, outFile);    fwrite(&this->fontset.WideChar, sizeof(this->fontset.WideChar), 1, outFile);}FontM *FontMNew(char *font){    FontM *this = (FontM *) malloc(sizeof(FontM));    this->theExpression.value = (long)this->lvalue;    strcpy(this->lvalue, font);    this->theExpression.type = MrmRtypeFont;    this->theExpression.Emit = (PFI)FontMEmit;    return this;}voidFontMEmit(FontM * this){    fputc(this->theExpression.type, outFile);    fwrite(this->lvalue, 1, strlen(this->lvalue), outFile);    fputc(0, outFile);}static voidFontElementEmit(FontElement * this){    FontSetEmit(this->theFontSet);    FontMEmit(this->theFont);}FontElement *FontElementNew(FontSet * theFontSet, FontM * theFont){    FontElement *this = (FontElement *) malloc(sizeof(FontElement));    this->Next = NULL;    this->theFontSet = theFontSet;    this->theFont = theFont;    return this;}voidFontTableAppend(FontTable * this, FontSet * theFontSet, FontM * theFont){    FontElement **i;    for (i = &this->FontVector; *i != NULL; i = &((*i)->Next));    *i = FontElementNew(theFontSet, theFont);}static voidFontTableEmit(FontTable * this){    FontElement **j;    int size = 0;    fputc(this->theExpression.type, outFile);    for (j = &this->FontVector; *j != NULL; j = &((*j)->Next))    {	size++;    }    fwrite(&size, sizeof(size), 1, outFile);    for (j = &this->FontVector; *j != NULL; j = &((*j)->Next))    {	FontElementEmit(*j);    };}FontTable *FontTableNew(void){    FontTable *this = (FontTable *) malloc(sizeof(FontTable));    this->theExpression.type = MrmRtypeFontList;    this->FontVector = NULL;    this->theExpression.value = (long)this->FontVector;    this->theExpression.Emit = (PFI)FontTableEmit;    return this;}static ColorDefinition *ColorDefinitionNew(char *color, int r, int g, int b){    ColorDefinition *this = (ColorDefinition *) malloc(sizeof(ColorDefinition));    if (NULL != color)    {	this->name = __MrmStore(color);    }    else    {	this->name = NULL;    }    this->r = r;    this->g = g;    this->b = b;    return this;}static voidColorDefinitionEmit(ColorDefinition * this){    if (this->name && this->name[0])    {	fputs(this->name, outFile);	fputc(0, outFile);    }    else    {	fputc(0, outFile);	fwrite(&this->r, sizeof(int), 1, outFile);	fwrite(&this->g, sizeof(int), 1, outFile);	fwrite(&this->b, sizeof(int), 1, outFile);    }}Color *ColorNew(char *color, int r, int g, int b){    Color *this = (Color *)malloc(sizeof(Color));    this->theDefinition = ColorDefinitionNew(color, r, g, b);    this->theExpression.value = (long)&this->theDefinition;    this->theExpression.type = MrmRtypeColor;    this->theExpression.Emit = (PFI)ColorEmit;    return this;}voidColorSetAddress(Color *this){    this->theExpression.type = MrmRtypeAddrName;}voidColorEmit(Color *this){    fputc(this->theExpression.type, outFile);    ColorDefinitionEmit(this->theDefinition);}voidFontSetDirectionRtoL(FontSet * this, int d){    this->fontset.DirectionRtoL = d;}voidFontSet16Bit(FontSet * this, int bits16){    this->fontset.WideChar = bits16;}voidFontSetName(FontSet * this, char *name){    this->fontset.name = __MrmStore(name);}XBitmapFile *XBitmapFileNew(char *FileName){    XBitmapFile *this = (XBitmapFile *)malloc(sizeof(XBitmapFile));    this->theExpression.type = MrmRtypeXBitmapFile;    this->theExpression.value = (long)&this->bitmap;    __MrmReadBitmapFileData(FileName, &(this->bitmap.width), &(this->bitmap.height),		       &(this->bitmap.data), &(this->bitmap.x_hot),		       &(this->bitmap.y_hot));    this->theExpression.Emit = (PFI)XBitmapFileEmit;    return this;}voidXBitmapFileEmit(XBitmapFile *this){    fputc(this->theExpression.type, outFile);    fwrite((char *)this->theExpression.value,	   sizeof(BitMapType) - sizeof(long), 1, outFile);    fwrite(this->bitmap.data,	   (this->bitmap.width * this->bitmap.height) >> 3, 1, outFile);}Keysym *KeysymNew(char *s){    Keysym *this = (Keysym *)malloc(sizeof(Keysym));    strcpy(this->lvalue, s);    this->theExpression.value = (long)this->lvalue;    this->theExpression.type = MrmRtypeKeysym;    this->theExpression.Emit = (PFI)KeysymEmit;    return this;}voidKeysymEmit(Keysym *this){    fputc(this->theExpression.type, outFile);    fwrite(this->lvalue, 1, strlen(this->lvalue), outFile);    fputc(0, outFile);}static ColorElement *ColorElementNew(char *rep, Color *color){    ColorElement *this = (ColorElement *)malloc(sizeof(ColorElement));    this->Next = NULL;    this->name = __MrmStore(rep);    this->theColor = color;    return this;}static voidColorElementEmit(ColorElement *this){    fputs(this->name, outFile);    fputc(0, outFile);    ColorEmit(this->theColor);}ColorTable *ColorTableNew(void){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -