/* * Adds a block to a movie. * This function adds a block or character to a movieclip. * returns a SWFDisplayItem */ SWFDisplayItem SWFMovieClip_add(SWFMovieClip clip, SWFBlock block) { if ( SWFBlock_getType(block) == SWF_DEFINEBITS || SWFBlock_getType(block) == SWF_DEFINEBITSJPEG2 || SWFBlock_getType(block) == SWF_DEFINEBITSJPEG3 || SWFBlock_getType(block) == SWF_DEFINELOSSLESS || SWFBlock_getType(block) == SWF_DEFINELOSSLESS2 ) { block = (SWFBlock)newSWFShapeFromBitmap((SWFBitmap)block, SWFFILL_TILED_BITMAP); } if ( SWFBlock_isCharacter(block) ) { SWFCharacter_getDependencies((SWFCharacter)block, &CHARACTER(clip)->dependencies, &CHARACTER(clip)->nDependencies); SWFCharacter_addDependency((SWFCharacter)clip, (SWFCharacter)block); SWFCharacter_setFinished((SWFCharacter)block); return SWFDisplayList_add(clip->displayList, clip->blockList, (SWFCharacter)block); } else { /* XXX - make sure it's a legit block for a sprite */ SWFBlockList_addBlock(clip->blockList, block); } return NULL; }
/*------------------------------------------------------------------------------ -- FUNCTION: UpdateDisplayBuf -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID UpdateDisplayBuf(HWND hWnd, CHAR cCharacter) -- hWnd - the handle to the window -- cCharacter - the character to add to the buffer -- -- RETURNS: VOID. -- -- NOTES: -- Adds cCharacter to the display buffer. ------------------------------------------------------------------------------*/ VOID UpdateDisplayBuf(HWND hWnd, CHAR cCharacter) { PWNDDATA pwd = NULL; CHAR a[2] = {0}; HDC hdc = {0}; CHARINFO ci = {0}; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); a[0] = cCharacter; CHARACTER(X, Y).character = cCharacter; CHARACTER(X, Y).fgColor = CUR_FG_COLOR; CHARACTER(X, Y).bgColor = CUR_BG_COLOR; CHARACTER(X, Y).style = CUR_STYLE; if (X >= CHARS_PER_LINE - 1) { if (pwd->wordWrap == FALSE) { return; } X = 0; if (Y < LINES_PER_SCRN - 1) { Y++; } else { ScrollDown(hWnd); } } else { X++; } }
static void writeSWFTextToMethod(SWFBlock block, SWFByteOutputMethod method, void *data) { SWFText text = (SWFText)block; int length = 0; SWFOutput out; if ( text->matrix == NULL ) text->matrix = newSWFMatrix(1.0, 0, 0, 1.0, 0, 0); length += (SWFMatrix_numBits(text->matrix)+7)/8; length += (SWFRect_numBits(CHARACTER(text)->bounds)+7)/8; length += 4; out = newSizedSWFOutput(length); SWFOutput_writeUInt16(out, CHARACTERID(text)); SWFOutput_writeRect(out, CHARACTER(text)->bounds); SWFOutput_writeMatrix(out, text->matrix); SWFOutput_writeUInt8(out, text->nGlyphBits); SWFOutput_writeUInt8(out, text->nAdvanceBits); SWFOutput_writeToMethod(out, method, data); SWFOutput_writeToMethod(text->out, method, data); destroySWFOutput(out); }
/* adds a character * Add a character to a button for given states * possible states: * SWFBUTTON_HIT * SWFBUTTON_DOWN * SWFBUTTON_OVER * SWFBUTTON_UP * states can be combined using the binary or operator * returns a SWFButtonRecord object which can be further modified. */ SWFButtonRecord SWFButton_addCharacter(SWFButton button /* button object */, SWFCharacter character /* character to be added */, byte state /* state description */) { SWFMatrix m; SWFButtonRecord record; SWFCharacter **depsPtr = &CHARACTER(button)->dependencies; int *depCount = &CHARACTER(button)->nDependencies; if ( SWFCharacter_isFinished((SWFCharacter)button) ) { SWF_warn("Can't alter a button after it's been added to another character"); return NULL; } SWFCharacter_getDependencies(character, depsPtr, depCount); SWFCharacter_addDependency((SWFCharacter)button, character); SWFCharacter_setFinished(character); m = newSWFMatrix(1.0, 0, 0, 1.0, 0, 0); record = newSWFButtonRecord(state, character, 0, m); SWFButton_addRecord(button, record); return record; }
static void resetBounds(SWFTextField field) { int minX, maxX, minY, maxY; SWFRect_getBounds(CHARACTER(field)->bounds, &minX, &maxX, &minY, &maxY); minX = -field->padding; minY = -field->padding; if ( field->width == 0 ) { int width = field->fontHeight*(field->string ? strlen(field->string) : 0); maxX = field->padding + width; } else maxX = field->padding + field->width; if ( field->fieldHeight == 0 ) { maxY = field->padding + field->fontHeight*field->nLines + (field->nLines-1)*field->lineSpacing; } else maxY = field->padding + field->fieldHeight; SWFRect_setBounds(CHARACTER(field)->bounds, minX, maxX, minY, maxY); }
/*------------------------------------------------------------------------------ -- FUNCTION: ClearLine -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID ClearLine(HWND hWnd, UINT cxCoord, UINT cyCoord, -- INT iDirection) -- hWnd - the handle to the window -- cxCoord - the row of the first -- character to clear - (0,0) origin -- cyCoord - the line of the first -- character to clear - (0,0) origin -- iDirection - the direction (left or right) to clear -- the line -- -- RETURNS: VOID. -- -- NOTES: -- Clears a line in the direction specified by iDirection (left or -- right). The character under the cursor will be cleared as well. -- Please note that cxCoord and cyCoord use a (0,0) origin. ------------------------------------------------------------------------------*/ VOID ClearLine(HWND hWnd, UINT cxCoord, UINT cyCoord, INT iDirection) { PWNDDATA pwd = NULL; UINT i = 0; UINT j = 0; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); i = cyCoord; j = cxCoord; while (j < CHARS_PER_LINE && j >= 0) { CHARACTER(j, i).character = ' '; CHARACTER(j, i).bgColor = CUR_BG_COLOR; CHARACTER(j, i).style = 0; j += iDirection; } }
/*------------------------------------------------------------------------------ -- FUNCTION: FormFeed -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID FormFeed(HWND hWnd) -- hWnd - the handle to the window -- -- RETURNS: VOID. -- -- NOTES: -- Clears the screen and moves the cursor to 1, 1 (0, 0 according -- to the display buffer). ------------------------------------------------------------------------------*/ VOID FormFeed(HWND hWnd) { PWNDDATA pwd = NULL; UINT i = 0; UINT j = 0; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); for (i = 0; i < LINES_PER_SCRN; i++) { for (j = 0; j < CHARS_PER_LINE; j++) { CHARACTER(j, i).character = ' '; CHARACTER(j, i).bgColor = CUR_BG_COLOR; CHARACTER(j, i).style = 0; } } X = 0; Y = 0; }
void SWFShape_drawScaledLine(SWFShape shape, int dx, int dy) { ShapeRecord record; if ( shape->isEnded ) return; if ( dx == 0 && dy == 0 ) return; record = newShapeRecord(shape, SHAPERECORD_LINETO); SWF_assert(SWFOutput_numSBits(dx) < 18); SWF_assert(SWFOutput_numSBits(dy) < 18); record.record.lineTo->dx = dx; record.record.lineTo->dy = dy; shape->xpos += dx; shape->ypos += dy; SWFRect_includePoint(SWFCharacter_getBounds(CHARACTER(shape)), shape->xpos, shape->ypos, shape->lineWidth); SWFRect_includePoint(shape->edgeBounds, shape->xpos, shape->ypos, 0); }
SWFText newSWFText() { SWFText text = (SWFText)malloc(sizeof(struct SWFText_s)); SWFCharacterInit((SWFCharacter)text); CHARACTERID(text) = ++SWF_gNumCharacters; BLOCK(text)->type = SWF_DEFINETEXT; BLOCK(text)->writeBlock = writeSWFTextToMethod; BLOCK(text)->complete = completeSWFText; BLOCK(text)->dtor = (destroySWFBlockMethod) destroySWFText; CHARACTER(text)->bounds = newSWFRect(0,0,0,0); text->out = newSWFOutput(); text->currentRecord = NULL; text->initialRecord = NULL; text->matrix = NULL; text->nAdvanceBits = 0; #if TRACK_ALLOCS text->gcnode = ming_gc_add_node(text, (dtorfunctype) destroySWFBitmap); #endif return text; }
/*------------------------------------------------------------------------------ -- FUNCTION: ClearScreen -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID ClearScreen(HWND hWnd, UINT cxCoord, UINT cyCoord, -- INT iDirection) -- hWnd - the handle to the window -- cxCoord - the row of the first -- character to clear - (0,0) origin -- cyCoord - the line of the first -- character to clear - (0,0) origin -- iDirection - the direction (up or down) to clear -- the screen -- -- RETURNS: VOID. -- -- NOTES: -- Clears the screen in the direction specified by iDirection (all -- preceding characters, or all following characters). The -- character under the cursor will be cleared as well. Please note -- that cxCoord and cyCoord use a (0,0) origin. ------------------------------------------------------------------------------*/ VOID ClearScreen(HWND hWnd, UINT cxCoord, UINT cyCoord, INT iDirection) { PWNDDATA pwd = NULL; UINT i = 0; UINT j = 0; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); ClearLine(hWnd, cxCoord, cyCoord, iDirection); i = cyCoord + iDirection; while (i < LINES_PER_SCRN && i >= 0) { for (j = 0; j < CHARS_PER_LINE; j++) { CHARACTER(j, i).character = ' '; CHARACTER(j, i).bgColor = CUR_BG_COLOR; CHARACTER(j, i).style = 0; } i += iDirection; } }
/* adds a shape character * Add a shape character to a button for given states * possible states: * SWFBUTTON_HIT * SWFBUTTON_DOWN * SWFBUTTON_OVER * SWFBUTTON_UP * states can be combined using the binary or operator * deprecated! use SWFButton_addCharacter instead */ void SWFButton_addShape(SWFButton button, SWFCharacter character, byte flags) { SWFMatrix m; SWF_warnOnce("SWFButton_addShape is deprecated\nUse SWFButton_addCharacter instead\n"); if ( SWFCharacter_isFinished((SWFCharacter)button) ) SWF_error("Can't alter a button after it's been added to another character"); m = newSWFMatrix(1.0, 0, 0, 1.0, 0, 0); SWFCharacter_getDependencies((SWFCharacter)character, &CHARACTER(button)->dependencies, &CHARACTER(button)->nDependencies); SWFCharacter_addDependency((SWFCharacter)button, (SWFCharacter)character); SWFCharacter_setFinished(character); SWFButton_addRecord(button, newSWFButtonRecord(flags, character, 0, m)); }
int completeSWFTextField(SWFBlock block) { SWFTextField field = (SWFTextField)block; /* we're guessing how big the block's going to be.. */ SWFOutput out = newSizedSWFOutput(42 + ((field->varName)?strlen(field->varName):0) + ((field->string)?strlen(field->string):0)); field->out = out; resetBounds(field); SWFOutput_writeUInt16(out, CHARACTERID(field)); SWFOutput_writeRect(out, CHARACTER(field)->bounds); SWFOutput_writeUInt16(out, field->flags); if(field->flags & SWFTEXTFIELD_HASFONT) { SWFOutput_writeUInt16(out, CHARACTERID(field->font.fontchar)); SWFOutput_writeUInt16(out, field->fontHeight); } if(field->flags & SWFTEXTFIELD_HASCOLOR) { SWFOutput_writeUInt8(out, field->r); SWFOutput_writeUInt8(out, field->g); SWFOutput_writeUInt8(out, field->b); SWFOutput_writeUInt8(out, field->a); } if ( field->flags & SWFTEXTFIELD_HASLENGTH ) SWFOutput_writeUInt16(out, field->length); if(field->flags & SWFTEXTFIELD_HASLAYOUT) { SWFOutput_writeUInt8(out, field->alignment); SWFOutput_writeUInt16(out, field->leftMargin); SWFOutput_writeUInt16(out, field->rightMargin); SWFOutput_writeUInt16(out, field->indentation); SWFOutput_writeUInt16(out, field->lineSpacing); } SWFOutput_writeString(out, (byte*) field->varName); if ( field->flags & SWFTEXTFIELD_HASTEXT ) SWFOutput_writeString(out, (byte*)field->string); /* XXX - if font is a real font, do we need to talk to it? flash 4 just makes a browser font for (editable) textfields for all fonts */ SWFOutput_byteAlign(out); return SWFOutput_getLength(out); }
void SWFShape_drawScaledCurve(SWFShape shape, int controldx, int controldy, int anchordx, int anchordy) { ShapeRecord record; if ( shape->isEnded ) return; if ( controldx == 0 && controldy == 0 && anchordx == 0 && anchordy == 0 ) return; // printf("curve %i,%i, %i, %i\n", controldx, controldy, anchordx, anchordy); record = newShapeRecord(shape, SHAPERECORD_CURVETO); record.record.curveTo->controlx = controldx; record.record.curveTo->controly = controldy; record.record.curveTo->anchorx = anchordx; record.record.curveTo->anchory = anchordy; if ( SWFOutput_numSBits(controldx) >= 18 || SWFOutput_numSBits(controldy) >= 18 || SWFOutput_numSBits(anchordx) >= 18 || SWFOutput_numSBits(anchordy) >= 18 ) SWF_error("Curve parameters too large"); /* including the control point is sloppy, but safe.. */ shape->xpos += controldx; shape->ypos += controldy; SWFRect_includePoint(SWFCharacter_getBounds(CHARACTER(shape)), shape->xpos, shape->ypos, shape->lineWidth); SWFRect_includePoint(shape->edgeBounds, shape->xpos, shape->ypos, 0); shape->xpos += anchordx; shape->ypos += anchordy; SWFRect_includePoint(SWFCharacter_getBounds(CHARACTER(shape)), shape->xpos, shape->ypos, shape->lineWidth); SWFRect_includePoint(shape->edgeBounds, shape->xpos, shape->ypos, 0); }
/*------------------------------------------------------------------------------ -- FUNCTION: ScrollUp -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID ScrollUp(HWND hWnd) -- hWnd - the handle to the window -- -- RETURNS: VOID. -- -- NOTES: -- "Scrolls up" one line. It moves every line on the screen down -- one position, deleting the bottom line, and creating a new, -- blank top line. ------------------------------------------------------------------------------*/ VOID ScrollUp(HWND hWnd) { PWNDDATA pwd = NULL; PLINE pNewLine = NULL; INT i = 0; INT j = 0; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); pNewLine = (PLINE) malloc(sizeof(LINE)); free(ROW(WINDOW_BOTTOM)); for (i = WINDOW_BOTTOM; i > WINDOW_TOP; i--) { ROW(i) = ROW(i - 1); } ROW(i) = pNewLine; for (j = 0; j < CHARS_PER_LINE; j++) { CHARACTER(j, i).character = ' '; CHARACTER(j, i).bgColor = CUR_BG_COLOR; CHARACTER(j, i).style = 0; } }
SWFText newSWFText() { SWFRect temp_rect; SWFText text = (SWFText)malloc(sizeof(struct SWFText_s)); /* If malloc failed, return NULL to signify this */ if (NULL == text) return NULL; SWFCharacterInit((SWFCharacter)text); CHARACTERID(text) = ++SWF_gNumCharacters; BLOCK(text)->type = SWF_DEFINETEXT; BLOCK(text)->writeBlock = writeSWFTextToMethod; BLOCK(text)->complete = completeSWFText; BLOCK(text)->dtor = (destroySWFBlockMethod) destroySWFText; temp_rect = newSWFRect(0,0,0,0); /* If newSWFRect() failed, return NULL to signify this */ if (NULL == temp_rect) { free(text); return NULL; } CHARACTER(text)->bounds = temp_rect; text->out = newSWFOutput(); /* If newSWFOutput() failed, return NULL to signify this */ if (NULL == text->out) { destroySWFRect(temp_rect); free(text); return NULL; } text->currentRecord = NULL; text->initialRecord = NULL; text->matrix = NULL; text->nAdvanceBits = 0; #if TRACK_ALLOCS text->gcnode = ming_gc_add_node(text, (dtorfunctype) destroySWFText); #endif return text; }
SWFFont newSWFFont() { SWFFont font = (SWFFont)malloc(SWFFONT_SIZE); memset(font, 0, SWFFONT_SIZE); CHARACTER(font)->number = ++SWF_gNumCharacters; BLOCK(font)->type = SWF_DEFINEFONT; BLOCK(font)->writeBlock = writeSWFFontToMethod; BLOCK(font)->complete = completeSWFFont; BLOCK(font)->dtor = destroySWFFont; return font; }
int main() { Container CharacterSet; CharacterSet.push_back( CHARACTER(2, "test1")); CharacterSet.push_back( CHARACTER(3, "test2")); CharacterSet.push_back( CHARACTER(1, "test3")); std::cout << "XXXX" << std::endl; std::for_each( CharacterSet.begin(), CharacterSet.end(), [](const CHARACTER& Char) { std::cout << "Level : " << Char.Level() << ", Name : " << Char.Name() << std::endl; } ); std::cout << std::endl << std::endl; std::cout << "XXXX" << std::endl; Container::nth_index<indices::IDX_NON_UNIQUE_CHAR>::type& Index1 = CharacterSet.get<indices::IDX_NON_UNIQUE_CHAR>(); std::for_each( Index1.begin(), Index1.end(), [](const CHARACTER& Char) { std::cout << "Level : " << Char.Level() << ", Name : " << Char.Name() << std::endl; } ); std::cout << std::endl; return 0; }
SWFShape newSWFShape() { SWFShape shape = (SWFShape)malloc(sizeof(struct SWFShape_s)); /* If malloc failed, return NULL to signify this */ if (NULL == shape) return NULL; SWFCharacterInit((SWFCharacter)shape); BLOCK(shape)->writeBlock = writeSWFShapeBlockToMethod; BLOCK(shape)->complete = completeSWFShapeBlock; BLOCK(shape)->dtor = (destroySWFBlockMethod) destroySWFShape; BLOCK(shape)->type = SWF_DEFINESHAPE3; CHARACTERID(shape) = ++SWF_gNumCharacters; shape->out = newSWFOutput(); CHARACTER(shape)->bounds = newSWFRect(0,0,0,0); shape->edgeBounds = newSWFRect(0,0,0,0); shape->records = NULL; shape->lines = NULL; shape->fills = NULL; shape->nRecords = 0; shape->xpos = 0; shape->ypos = 0; shape->nLines = 0; shape->nFills = 0; shape->lineWidth = 0; shape->isMorph = FALSE; shape->isEnded = FALSE; shape->flags = 0; shape->useVersion = SWF_SHAPE3; SWFOutput_writeUInt8(shape->out, 0); /* space for nFillBits, nLineBits */ #if TRACK_ALLOCS shape->gcnode = ming_gc_add_node(shape, (dtorfunctype) destroySWFShape); #endif return shape; }
SWFDBLBitmapData newSWFDBLBitmapData_fromData(dblData data) { SWFDBLBitmapData dbl; dbl = (SWFDBLBitmapData)malloc(sizeof(struct SWFDBLBitmapData_s)); /* If malloc failed, return NULL to signify this */ if (NULL == dbl) return NULL; SWFCharacterInit((SWFCharacter)dbl); CHARACTERID(dbl) = ++SWF_gNumCharacters; BLOCK(dbl)->writeBlock = writeSWFDBLBitmapDataToMethod; BLOCK(dbl)->complete = completeSWFDBLBitmap; BLOCK(dbl)->dtor = (destroySWFBlockMethod) destroySWFDBLBitmapData; dbl->width = data->width; dbl->height = data->height; dbl->format = data->format; dbl->format2 = data->format2; dbl->data = data->data; if(data->hasalpha) BLOCK(dbl)->type = SWF_DEFINELOSSLESS2; else BLOCK(dbl)->type = SWF_DEFINELOSSLESS; BLOCK(dbl)->length = data->length; BLOCK(dbl)->length += 7; /* character id, format, width, height */ if(dbl->format == 3) BLOCK(dbl)->length++; CHARACTER(dbl)->bounds = newSWFRect(0, dbl->width, 0, dbl->height); #if TRACK_ALLOCS dbl->gcnode = ming_gc_add_node(dbl, (dtorfunctype)destroySWFDBLBitmapData); #endif return dbl; }
static int completeSWFText(SWFBlock block) { int length = 4; SWFText text = (SWFText)block; SWFText_resolveCodes(text); length += SWFOutput_getLength(text->out); if ( text->matrix ) length += (SWFMatrix_numBits(text->matrix)+7)/8; else ++length; length += (SWFRect_numBits(CHARACTER(text)->bounds)+7)/8; return length; }
void SWFShape_addStyleHeader(SWFShape shape) { SWFOutput out = newSWFOutput(); SWFOutput_writeUInt16(out, CHARACTERID(shape)); SWFOutput_writeRect(out, SWFCharacter_getBounds(CHARACTER(shape))); if (shape->isUsingNewStyles) { shape->nFills2 = 0; shape->nLines2 = 0; } SWFOutput_writeFillStyles(out, shape->fills2, shape->nFills2, BLOCK(shape)->type); SWFOutput_writeLineStyles(out, shape->lines2, shape->nLines2, BLOCK(shape)->type); /* prepend shape->out w/ shape header */ SWFOutput_setNext(out, shape->out); shape->out = out; }
void SWFShape_addStyleHeader(SWFShape shape) { SWFOutput out = newSWFOutput(); SWFOutput_writeUInt16(out, CHARACTERID(shape)); SWFOutput_writeRect(out, SWFCharacter_getBounds(CHARACTER(shape))); if(shape->useVersion == SWF_SHAPE4) { SWFOutput_writeRect(out, shape->edgeBounds); SWFOutput_writeUInt8(out, shape->flags); } SWFOutput_writeFillStyles(out, shape->fills, shape->nFills, BLOCK(shape)->type, shape->edgeBounds); SWFOutput_writeLineStyles(out, shape->lines, shape->nLines, BLOCK(shape)->type); /* prepend shape->out w/ shape header */ SWFOutput_setNext(out, shape->out); shape->out = out; }
/*------------------------------------------------------------------------------ -- FUNCTION: Paint -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: Paint(HWND hWnd) -- hWnd - the handle to the window -- -- RETURNS: VOID. -- -- NOTES: -- Repaints the display buffer. ------------------------------------------------------------------------------*/ VOID Paint(HWND hWnd) { PLOGFONT plf = NULL; PWNDDATA pwd = NULL; CHAR a[2] = {0}; HDC hdc = {0}; PAINTSTRUCT ps = {0}; UINT i = 0; UINT j = 0; UINT tempfgColor = 0; UINT tempbgColor = 0; UINT tempStyle = 0; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); hdc = BeginPaint(hWnd, &ps) ; SelectObject(hdc, pwd->displayBuf.hFont); tempfgColor = CUR_FG_COLOR; tempbgColor = CUR_BG_COLOR; tempStyle = CUR_STYLE; SetTextColor(hdc, TXT_COLOURS[CUR_FG_COLOR]); SetBkColor(hdc, TXT_COLOURS[CUR_BG_COLOR]); for (i = 0; i < LINES_PER_SCRN; i++) { for (j = 0; j < CHARS_PER_LINE; j++) { if (CHARACTER(j, i).fgColor != tempfgColor) { SetTextColor(hdc, TXT_COLOURS[CHARACTER(j, i).fgColor]); tempfgColor = CHARACTER(j, i).fgColor; } if (CHARACTER(j, i).bgColor != tempbgColor) { SetBkColor(hdc, TXT_COLOURS[CHARACTER(j, i).bgColor]); tempbgColor = CHARACTER(j, i).bgColor; } a[0] = CHARACTER(j, i).character; TextOut(hdc, CHAR_WIDTH * j + PADDING, CHAR_HEIGHT * i + PADDING, (LPCWSTR) a, 1); } } EndPaint(hWnd, &ps); }
/* move pen relative to shape origin */ void SWFShape_moveScaledPenTo(SWFShape shape, int x, int y) { ShapeRecord record; if ( shape->isEnded ) return; record = addStyleRecord(shape); record.record.stateChange->moveToX = shape->xpos = x; record.record.stateChange->moveToY = shape->ypos = y; record.record.stateChange->flags |= SWF_SHAPE_MOVETOFLAG; if ( shape->nRecords == 0 || (shape->nRecords == 1 && shape->records[0].type == SHAPERECORD_STATECHANGE) ) { SWFRect_setBounds(SWFCharacter_getBounds(CHARACTER(shape)), x, x, y, y); SWFRect_setBounds(shape->edgeBounds, x, x, y, y); } }
* Original version (Converted from ERR_SYSER) * 23-JUL-2008 (TIMJ): * Now written in C to call errSyser * {enter_changes_here} * Bugs: * {note_any_bugs_here} *- */ #include "f77.h" #include "merswrap.h" #include "mers_f77.h" F77_SUBROUTINE(err_facer)( CHARACTER(TOKEN), INTEGER(STATUS) TRAIL(TOKEN) ) { char *token; int status; GENPTR_CHARACTER(TOKEN); token = starMallocAtomic( TOKEN_length + 1 ); F77_IMPORT_CHARACTER( TOKEN, TOKEN_length, token ); F77_IMPORT_INTEGER( *STATUS, status ); errFacer( token, status ); starFree( token ); }
#include <X11/Xlib.h> #include <ctype.h> #include <string.h> #include "sae_par.h" #include "gwm_err.h" #include "gwm_for.h" #include "cnf.h" #include "f77.h" #include "ems.h" /******************************************************************************/ F77_SUBROUTINE(gwm_wsetc) ( CHARACTER(option), CHARACTER(value), INTEGER(status) TRAIL(option) TRAIL(value) ) /* *+ * Name: * GWM_WSETC * * Purpose: * Set an character string window option * * Language: * C * * Invocation: * CALL GWM_WSETC( OPTION, VALUE, STATUS ) * * Description: * The window options are used to control the characteristics of
* Foundation, Inc., 51 Franklin Street,Fifth Floor, Boston, MA * 02110-1301, USA * Copyright: * Copyright (C) 2006 Particle Physics & Astronomy Research Council. * All Rights Reserved. * Authors: *- */ #include "ems.h" /* ems_ function prototypes */ #include "ems_sys.h" /* EMS internal constants */ #include "f77.h" /* CNF macros and prototypes */ #include "ems_f77.h" F77_SUBROUTINE(ems_facer) ( CHARACTER(token), INTEGER(fstat) TRAIL(token) ) { char ctok[EMS__SZNAM+1]; /* Imported token name */ GENPTR_CHARACTER(token) GENPTR_INTEGER(fstat) cnfImpn( token, token_length, EMS__SZNAM, ctok ); emsFacer( ctok, *fstat ); return; }
* {enter_new_authors_here} * History: * 17-May-1996 (fcwrap): * Original version * 22-May-1996 (PDRAPER): * Changed to return array of doubles. * {enter_changes_here} *- */ #include <string.h> #include "cnf.h" #include "f77.h" F77_SUBROUTINE(hdr_ind)( CHARACTER(param), CHARACTER(xname), CHARACTER(item), INTEGER(comp), DOUBLE_ARRAY(value), INTEGER(status) TRAIL(param) TRAIL(xname) TRAIL(item) ); void hdrInD( char *param, char *xname, char *item, int comp, double *value, int *status ) {
/* Header files. */ /* ============= */ /* C run-time library header files. */ #include <string.h> /* String handling */ /* External interface header files. */ #include "f77.h" /* C<-->Fortran interface macros */ #include "dat_par.h" /* Hierarchical Data System (HDS) */ /* Internal header files. */ #include "ndf.h" /* NDF_ library public interface */ /* Wrapper function implementations. */ /* ================================= */ F77_SUBROUTINE(ndf_assoc)( CHARACTER(param), CHARACTER(mode), INTEGER(indf), INTEGER(status) TRAIL(param) TRAIL(mode) ); void ndfAssoc( const char *param, const char *mode, int *indf, int *status ) { DECLARE_CHARACTER_DYN(fparam); DECLARE_CHARACTER_DYN(fmode); DECLARE_INTEGER(findf); DECLARE_INTEGER(fstatus);
#endif #if STDC_HEADERS # include <string.h> # include <time.h> /* C time library */ /* if we start to use sys/time.h, see autoconf AC_HEADER_TIME */ #endif #include "f77.h" /* C - Fortran interface */ #include "sae_par.h" /* ADAM constants */ /* Number of characters mandated by ctime for buffer space */ #define SZ_CTIME 26 F77_SUBROUTINE(psx_ctime)( INTEGER(nticks), CHARACTER(string), INTEGER(status) TRAIL(string) ) { /* Pointers to Arguments: */ GENPTR_INTEGER(nticks) GENPTR_CHARACTER(string) GENPTR_INTEGER(status) /* Local Variables: */ time_t timep; /* Local version of nticks */ int i; /* Loop counter */ char time_s[SZ_CTIME+1]; /* The string returned by asctime */ #if HAVE_CTIME && !HAVE_CTIME_R