TweetFollow Us on Twitter

Spreadsheet
Volume Number:5
Issue Number:3
Column Tag:C Workshop

Related Info: List Manager

How to Write a Spreadsheet in LS C

By Bryan Waters, Casselberry, FL

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

Bryan Waters is a Software Engineer for Maynard Electronics, and is currently working as part of a team to develop a finder-like tape backup system.

Dear Cary Mariash

In the January ’88 issue of MacTutor, a letter sent by Cary Mariash requested information on Macintosh tools to create spreadsheet type windows. MacTutorCalc is an example of a simple (very simple!) spreadsheet type application, that uses the List Manager ( IM - IV ) to create it’s windows. (Note: MacTutorCalc is written in Think C 3.0, see the project window in figure 1 )

Figure 1. Lightspeed C Project Window

List Manager in action!

The call to Lnew is used to create the list (figure 2). The dataBounds parameter is set to have an extra row and column than our work area. This, of course, is to support the row and column headers. After the list has been created the programmer has several more options, involving selection, and installing a routine in the lClikLoop field to be called repeatedly while LClick has control. The selFlags field of the list handle allow complete customization of the selection algorithm used by the list manager. MacTutorCalc is content to use the default selection, but when we call LClick to handle our mouseDown events in the window, any scrolling causes the spreadsheet to scroll, without the grid being updated. To fix this, MacTutorCalc installs a lClickLoop routine to update the grid continuously during calls to LClick. This works great, except the List Manager does not call this routine when the mouse button is pressed in the scroll bars, so that the grid is updated then only after the mouse button is released. Although it is not implemented here, this could be fixed by installing a pointer to our grid routine in the system global DragHook ( $9F6 ) which is called by DragGrayRgn. Since the control manager routine TrackControl calls DragGrayRgn to drag the outline of the scroll bars thumb button, this would achieve the desired effect.

Figure 2. Spreadsheet & Dialog Entry

There are other points to take into account when using a window such as this. For example, when the user resizes the window, it would not be desirable to allow the user to size the window out of alignment with the cell boundries simply because it looks bad. To handle this, after the call to GrowWindow, we make sure that the new size is a multiple of the cell size. Updating is handled almost completely by the list manager routine LUpdate, although we still have to draw the grid, and the grow icon.

Data entry is probably where MacTutorCalc could be improved the most. Currently data entry is implemented by double-clicking on the desired cell ( LClick returns TRUE when a cell was double-clicked and a call to LLastClick is used to get the cell’s address). This brings up a dialog prompting for the data. In an application intended for serious use, this would get extremely tiring. This could be fixed by adding a data entry window at the top of the screen ( Excel Style ) and allowing the user to enter data into the currently selected cell through this window. At this point we have data that needs to processed, so we determine the type of data ( formula, or string ) and then set our calculation flag. The routine DoCalc is called in response to this, and processes the whole spreadsheet, calling the parser for formula, and ignoring strings. After the data has been parsed, LSetCell is used to put the data into the list. Alternatively, if the cell has been blanked out, then LClrCell is used to clear the data.

About MacTutorCalc

MacTutorCalc is a simple spreadsheet written for the purpose of demonstrating use of the list manager. The work area for our application is set to 8 columns by 8 rows. It is capable of accepting both strings and formulae, and constants. Data is entered into a cell by double-clicking on it. I know that this is awkward, but other methods would have unnecessarily complicated this example. Any data entered into a cell that starts with “=” is considered a formula and will be parsed, and any number will be treated as a constant, everything else is considered a string. A formula can be any simple algebraic expression, using floating or absolute cell addresses. There a few simple functions in MacTutorCalc that use the Math library distributed with Think C. In the future, we could expand our spreadsheet to include:

• ability to save and retrieve spreadsheets

• a full function library

• cell formatting and spreadsheet editing features

• memory paging system to support larger spreadsheet sizes

• support for SYLK format

[There is a known bug in the text to binary conversion routines. Apple's conversion routines were used, and so large formatted numbers will not be converted to text correctly. Note also that Apple frowns on trying to use the List Manager to write the next Excel Product, so if you get serious about this project, re-write it without using the List Manager. -Ed]

Listing:  CalcData.h

/* Global data */
extern int quit_flag ;

extern Rect minmax_size ;
extern Rect curr_screen ;
extern int automatic_calculation ;
extern int calc_data ;
extern int do_calc_now ;
extern SHEET_WIN_PTR curr_sheet_ptr ;
extern SHEET_WIN_HDL calc_hdl ;
extern FUN_ENTRY fun_table[] ;
extern ARG arg_free_pool[ ] ;
Listing:  MacCalc.h

#include <MacTypes.h>
#include <ListMgr.h>
#ifndef NULL
#define NULL    0L
#endif
#define MAX_ROWS     8
#define MAX_COLUMNS       8
#define CELL_WIDTH        96
#define CELL_HEIGTH  16

#define ENTER_DATA_DIALOG        128
#define APPLE_MENU                1
#define FILE_MENU                256
#define EDIT_MENU                257

/* Types for cell */
#define CLEARED        -1
#define UNDEFINED    0
#define STRING        1
#define FORMULA        2
#define CONSTANT    3

struct cell_struct{
    int type ;
    double value ;
    Str255 formula ;
} ;

typedef struct cell_struct CELL, *CELL_PTR, **CELL_HDL ;

struct sheet_win{
    WindowPtr sheet_window_ptr ;
    ListHandle sheet_list_hdl ;
    CELL sheet_data[MAX_ROWS][MAX_COLUMNS] ;
} ;

typedef struct sheet_win SHEET_WIN, *SHEET_WIN_PTR, **SHEET_WIN_HDL ;

/* Argument types */
#define VALUE_ARG 1
#define STRING_ARG 2
/* Arg usage defines */
#define IN_USE   TRUE
#define FREE_ARG FALSE

struct fun_arg{
    struct fun_arg *next_arg ;
    int in_use ;
    int type ;
    double value ;
    Str255 string ;
} ;

typedef struct fun_arg ARG, *ARG_PTR, **ARG_HDL ;
struct fun_entry{
    char fun_name[32] ;
    double (*fun_ptr)( ) ;
} ;

typedef struct fun_entry FUN_ENTRY, *FUN_ENTRY_PTR, **FUN_ENTRY_HDL ;

/* Prototypes */
int DoInit( void ) ;
void DoEventLoop( void ) ;
void DoActivate( EventRecord * ) ;
void DoUpdate( EventRecord * ) ;
void DoMouseDown( EventRecord * ) ;

int ClikLoop( void ) ;
void EnterData( Cell, SHEET_WIN_HDL ) ;
void DoCalc( SHEET_WIN_HDL ) ;
Listing:  SheetHndlg.h

/* SpreadSheet Handling prototypes */
int OpenNewSpreadsheet( char * ) ;
int DrawGrid( WindowPtr ) ;
Listing:  Parser.h

/* Parse errors */
#define MISMATCHED_PARENTHESIS      200
#define INVALID_NUMBER              201
#define INVALID_ADDRESS             202
#define ADDRESS_TOO_LARGE            203
#define INVALID_FUNCTION            204

/* Prototypes */
void SetType( CELL_PTR, int ) ;
double ParseFormula( unsigned char *, int * ) ;
double ParseExpression( void ) ;
double ParseFactor( void ) ;
double ParseValue( void ) ;
double ParseAddress( void ) ;
#define IsDigit(x) (((x)<=’9') && ((x)>=’0'))
#define IsAlpha(x) ( ( ( (x) >= ‘A’ ) && ( (x) <= ‘Z’ ) ) || ( ( (x) 
>= ‘a’ ) && ( (x) <= ‘z’ ) ) )
int IsFunction( void ) ;
int GetRow( void ) ;
int GetColumn( void ) ;
double CallFunction( ) ;
int Lookup( unsigned char * ) ;
ARG_PTR BuildArg( void ) ;
double atof( void ) ;
void ftoa( double, unsigned char * ) ;
double GetFloat( unsigned char *, int * ) ;
ARG_PTR GetArg( void ) ;
void PutArg( ARG_PTR ) ;
void DestroyArgs( ARG_PTR ) ;
Listing:  CalcData.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”

/* Global data */
int quit_flag = FALSE ;

/* Grow window limits */
Rect minmax_size ;
/* Current screen size */
Rect curr_screen ;

/* do calculation switches */
int automatic_calculation = TRUE ;
int calc_data = FALSE ;
int do_calc_now = FALSE ;

/* Current spreadsheet globals */
SHEET_WIN_PTR curr_sheet_ptr ;
SHEET_WIN_HDL calc_hdl ;

extern double fsum( ), fabsolute( ), fmodulus( ), fsqrt( ) ;

/* Function table */
FUN_ENTRY fun_table[] = {
    /* Standard math functions */
    { “SUM”, fsum },
    { “ABS”, fabsolute },
    { “MOD”, fmodulus },
    { “SQRT”, fsqrt },
    { 0 } } ;
    
ARG arg_free_pool[30] = {
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 },
    { NULL, FREE_ARG, 0, 0, 0 } };
Listing:  DoActivate.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”
#include “CalcData.h”

void DoActivate( ev )
EventRecord *ev ;
{
    WindowPtr curr_window_ptr ;
    SHEET_WIN_HDL sheet_record_hdl ;
    int activate ;
 
    activate = ev->modifiers&0x0001 ;
 
    /* Get spreadsheet hdl */
    curr_window_ptr = (WindowPtr)ev->message ;
    sheet_record_hdl = (SHEET_WIN_HDL)GetWRefCon( curr_window_ptr ) ;
 
    /* Do list activation or deactivation */
    LActivate( activate, (**sheet_record_hdl).sheet_list_hdl);
    return ;
}
Listing:  DoCalc.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “CalcData.h”
#include “Parser.h”

void DoCalc( sheet_record_hdl )
SHEET_WIN_HDL sheet_record_hdl ;
{
    int i, j ;
    Str255 buffer ;
    Cell curr_cell ;
    int error ;
    char *err_mess ;
    
    /* Lock and dereference the handle */
    HLock( (Handle)sheet_record_hdl ) ;
    curr_sheet_ptr = *sheet_record_hdl ;
    
    /* Process all cells */
    for( i=0;i<MAX_ROWS;i++ ) {
        for( j=0;j<MAX_COLUMNS;j++) {
            switch( curr_sheet_ptr->sheet_data[i][j].type ) {
            /* If cell type is undefined then do nothing */
            case UNDEFINED:
                break ;
            /* If cell type is undefined then clear cell */
            case CLEARED:
                SetPt( &curr_cell, j+1, i+1 ) ;
                LClrCell( curr_cell, curr_sheet_ptr->sheet_list_hdl ) 
;
                curr_sheet_ptr->sheet_data[i][j].type = UNDEFINED ;
                break ;
            /* If cell type is string,  put string in cell */
            case STRING:
                SetPt( &curr_cell, j+1, i+1 ) ;
                LSetCell( &curr_sheet_ptr->sheet_data[i][j].formula[1],
                          curr_sheet_ptr->sheet_data[i][j].formula[0],
                          curr_cell,
                          curr_sheet_ptr->sheet_list_hdl ) ;
                break ;
            case CONSTANT:
                SetPt( &curr_cell, j+1, i+1 ) ;
                curr_sheet_ptr->sheet_data[i][j].value = 
                    GetFloat( curr_sheet_ptr->sheet_data[i][j].formula, 
&error ) ;
                if( error ) {
                    Alert( error, NULL ) ;
                    err_mess = “\p***ERROR***” ;
                    LSetCell( err_mess+1, *err_mess, curr_cell, curr_sheet_ptr->sheet_list_hdl 
) ;
                }else{
                    ftoa( curr_sheet_ptr->sheet_data[i][j].value, buffer 
) ;
                    LSetCell( &buffer[1],
                          buffer[0],
                          curr_cell,
                          curr_sheet_ptr->sheet_list_hdl ) ;
                }
                break ;
            /* Parse formula then convert value to string and put in 
cell */
            case FORMULA:
                SetPt( &curr_cell, j+1, i+1 ) ;
                curr_sheet_ptr->sheet_data[i][j].value = 
                    ParseFormula( curr_sheet_ptr->sheet_data[i][j].formula, 
&error ) ;
                if( error ) {
                    Alert( error, NULL ) ;
                    err_mess = “\p***ERROR***” ;
                    LSetCell( err_mess+1, *err_mess, curr_cell, curr_sheet_ptr->sheet_list_hdl 
) ;
                }else{
                    ftoa( curr_sheet_ptr->sheet_data[i][j].value, buffer 
) ;
                    LSetCell( &buffer[1],
                          buffer[0],
                          curr_cell,
                          curr_sheet_ptr->sheet_list_hdl ) ;
                }
                break ;
            }
        }
    }
    calc_data = FALSE ;
    DrawGrid( curr_sheet_ptr->sheet_window_ptr ) ;
    HUnlock( (Handle)sheet_record_hdl ) ;
    return ;
}
Listing:  DoInit.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”
#include “CalcData.h”

void CreateMenus( void ) ;

int DoInit( )
{
    
    /* initialize all the MacIntosh Managers */ 
    InitGraf( ( Ptr)&thePort ) ; /* initialize quickdraw */ 
    InitFonts( ) ; /* initialize the font manager */ 
    InitWindows( ) ; /* initialize the window manager */ 
    InitCursor( ) ; /* initialize the cursor */ 
 InitMenus( ) ; /* initialize the menu manager */ 
 TEInit( ) ; /* initialize the text edit manager */ 
 InitDialogs( NULL ) ; /* initialize dialog manager */ 
    
    /* Flush events */
    
    FlushEvents( everyEvent, 0 ) ;
    
    /* Get curr screen size */
    curr_screen = screenBits.bounds ;
    SetRect( &minmax_size, 207, 77, 447, 159 ) ;

    /* Expand heap to maximum and allocate more masters */ 
    MaxApplZone( ) ; 
    MoreMasters( ) ; 
    MoreMasters( ) ; 
    MoreMasters( ) ; 
    MoreMasters( ) ; 
    MoreMasters( ) ;
    
    CreateMenus( ) ;
    
    OpenNewSpreadsheet( “\pUntitled” ) ;
}
void CreateMenus( )
{
    MenuHandle menu ;
    
    menu = GetMenu( 1 ) ;
    AddResMenu( menu, ‘DRVR’ ) ;
    InsertMenu( menu, 0 ) ;
    InsertMenu( GetMenu( 256 ), 0 ) ;
    InsertMenu( GetMenu( 257 ), 0 ) ;
    DrawMenuBar( ) ;
}
Listing:  DoMouse.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”
#include “CalcData.h”

WindowPtr curr_window_ptr ;

void DoMouseDown( ev )
EventRecord *ev ;
{
    SHEET_WIN_HDL sheet_record_hdl ;
    Point new_point ;
    int location ;
    GrafPtr tmp_port ;
    Rect boundsRect ;
    long newsize ;
    long menuchoice ;
    int width, heigth ;
    union {
        long tmp ;
        Cell last_cell ;
    } a ;
    
    location = FindWindow( ev->where, &curr_window_ptr ) ;
    
    if( ( curr_window_ptr != FrontWindow( ) ) && ( curr_window_ptr != 
NULL ) ) {
        SelectWindow( curr_window_ptr ) ;
        return ;
    }
    
    new_point = ev->where ;
    GetPort( &tmp_port ) ;
    SetPort( curr_window_ptr ) ;
    GlobalToLocal( &new_point ) ;
    
    switch( location ) {
    case inDesk:
        break ;
    case inMenuBar:
        menuchoice = MenuSelect( ev->where ) ;
        if( HiWord( menuchoice ) == FILE_MENU ) {
            quit_flag = TRUE ;
        }
        HiliteMenu( 0 ) ;
        break ;
    case inContent:
        sheet_record_hdl = (SHEET_WIN_HDL)GetWRefCon( curr_window_ptr 
) ;
        if( LClick( new_point, ev->modifiers, (**sheet_record_hdl).sheet_list_hdl 
) ) {
   a.tmp = LLastClick((**sheet_record_hdl).sheet_list_hdl ) ;
            EnterData( a.last_cell, sheet_record_hdl ) ;
        }
        DrawGrid( curr_window_ptr ) ;
        break ;
    case inDrag:
        boundsRect = curr_screen ;
        DragWindow( curr_window_ptr, ev->where, &boundsRect ) ;
        break ;
    case inGrow:
        sheet_record_hdl = (SHEET_WIN_HDL)GetWRefCon( curr_window_ptr 
) ;
        newsize = GrowWindow( curr_window_ptr, ev->where, &minmax_size 
) ;
        if( newsize ) {
            width = ( ( LoWord( newsize ) / CELL_WIDTH ) * CELL_WIDTH 
) + 15 ;
            heigth = ( ( HiWord( newsize ) / CELL_HEIGTH ) * CELL_HEIGTH 
) + 15 ;
            SizeWindow( curr_window_ptr, width, heigth, TRUE ) ;
            LSize( width-15, heigth-15, (**sheet_record_hdl).sheet_list_hdl 
) ;
            DrawGrid( curr_window_ptr ) ;
            DrawGrowIcon( curr_window_ptr ) ;
        }
        break ;
    case inGoAway:
        if( TrackGoAway( curr_window_ptr, ev->where ) ) {
            quit_flag = TRUE ;
        }
        break ;
    }
    SetPort( tmp_port ) ;

    return ;
}
int ClikLoop( )
{
    DrawGrid( curr_window_ptr ) ;
    return TRUE ;
}
Listing:  DoUpdate.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”
#include “CalcData.h”

void DoUpdate( ev )
EventRecord *ev ;
{
    WindowPtr curr_window_ptr ;
    SHEET_WIN_HDL sheet_record_hdl ;

    curr_window_ptr = (WindowPtr)ev->message ;
    
    sheet_record_hdl = (SHEET_WIN_HDL)GetWRefCon( curr_window_ptr ) ;
    
    BeginUpdate( curr_window_ptr ) ;
    
    LUpdate( curr_window_ptr->visRgn, (**sheet_record_hdl).sheet_list_hdl 
) ;
    
    DrawGrid( curr_window_ptr ) ;
    
    DrawGrowIcon( curr_window_ptr ) ;
    
    EndUpdate( curr_window_ptr ) ;
    
    return ;
}
Listing:  DrawGrid.c

#include <ListMgr.h>
#include <WindowMgr.h>
#include <MacTypes.h>
#include <QuickDraw.h>

#include “MacCalc.h”
#include “SheetHndlg.h”

int DrawGrid( win_ptr )
WindowPtr win_ptr ;
{
    GrafPtr tmp_port ;
    Rect win_rect ;
    int bottom ;
    int right ;
    int num_h_lines ;
    int num_v_lines ;
    int i, max ;
    
    GetPort( &tmp_port ) ;
    SetPort( win_ptr ) ;
    
    PenNormal( ) ;
    PenPat( gray ) ;
    
    win_rect = win_ptr->portRect ;
    bottom = win_rect.bottom - 15 ;
    right = win_rect.right - 15 ;
    num_h_lines = bottom / CELL_HEIGTH ;
    num_v_lines = right / CELL_WIDTH ;
    
    max = ( num_h_lines > num_v_lines ) ? num_h_lines:num_v_lines ;
    
    for( i = 1 ; i <= max ; i++ ) {
        if( i < num_h_lines ) {
            MoveTo( 0, i*CELL_HEIGTH ) ;
            LineTo( right, i*CELL_HEIGTH ) ;
        }
        if( i < num_v_lines ) {
            MoveTo( i*CELL_WIDTH, 0 ) ;
            LineTo( i*CELL_WIDTH, bottom ) ;
        }
    }
    PenNormal( ) ;
    SetPort( tmp_port ) ;
            return ;
}
Listing:  EntrData.c

#include <ListMgr.h>
#include <DialogMgr.h>
#include <MemoryMgr.h>
#include <QuickDraw.h>

#include “MacCalc.h”
#include “SheetHndlg.h”
#include “CalcData.h”
#include “Parser.h”

#define ENTER_BUTTON  1
#define CANCEL_BUTTON 2
#define DATA_ITEM     4

void EnterData( cell, sheet_record_hdl )
Cell cell ;
SHEET_WIN_HDL sheet_record_hdl ;
{
    DialogPtr new_dialog ;
    int item_hit ;
    Handle hdl ;
    Rect box ;
    int type ;
    int had_data = FALSE ;
     
    if( ( cell.v ) != 0 && ( cell.h != 0 ) ) {
     
        HLock( (Handle)sheet_record_hdl ) ;
        new_dialog = GetNewDialog( ENTER_DATA_DIALOG, NULL, (WindowPtr)-1L 
) ;
        
        /* Outline button */
        SetPort( new_dialog ) ;
        GetDItem( new_dialog, ENTER_BUTTON, &type, &hdl,&box) ;
        PenNormal( ) ;
        PenSize( 3,3 ) ;
        InsetRect( &box, -4,-4 ) ;
        FrameRoundRect( &box, 16,16 ) ;

        GetDItem( new_dialog, DATA_ITEM, &type, &hdl, &box ) ;
          
        if( (**sheet_record_hdl).sheet_data[cell.v-1][cell.h-1].formula[0] 
!= 0 ) {
            SetIText( hdl, (**sheet_record_hdl).sheet_data[cell.v-1][cell.h-1].formula) 
;
            SelIText( new_dialog, DATA_ITEM, 0, 255 ) ;
            had_data = TRUE ;
        }
          
        do{
            ModalDialog( NULL, &item_hit ) ;
        }while( item_hit == DATA_ITEM ) ;
          
        if( item_hit != CANCEL_BUTTON ) {
            GetIText( hdl, &(**sheet_record_hdl).sheet_data[cell.v-1][cell.h-1].formula);
            SetType( &(**sheet_record_hdl).sheet_data[cell.v-1][cell.h-1], 
had_data ) ;
            calc_hdl = sheet_record_hdl ;
            calc_data = TRUE ;
        }
        CloseDialog( new_dialog ) ;
        HUnlock( (Handle)sheet_record_hdl ) ;
    }else{
        SysBeep( 1 ) ;
    }
    return ;
}
Listing:  functions.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include <Math.h>

#include “MacCalc.h”
#include “CalcData.h”
#include “Parser.h”

double fsum( arg )
ARG_PTR arg ;
{
    double value = 0 ;
    
    value += arg->value ;
    
    while( arg->next_arg != NULL ) {
        arg = arg->next_arg ;
        value += arg->value ;
    }
    return value ;
}
double fabsolute( arg )
ARG_PTR arg ;
{
    register double value ;
    
    value = arg->value ;
    return( ( value >= 0 ) ? value:-value ) ;
}
double fmodulus( arg )
ARG_PTR arg ;
{
    register double value1 ;
    register double value2 ;
    ARG_PTR curr_arg = arg ;
    
    value1 = arg->value ;
    value2 = arg->next_arg->value ;
    return( fmod( value1, value2 ) ) ;
}
double fsqrt( arg )
ARG_PTR arg ;
{
    register double value ;
    
    value = arg->value ;
 return( sqrt( value ) ) ;
}
Listing:  MacCalc.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”
#include “CalcData.h”
#include “parser.h”

main( ) 
{
        
    DoInit( ) ;
    DoEventLoop( ) ;
}
void DoEventLoop( )
{
    EventRecord ev ;
    
    while( !quit_flag ) {
        SystemTask( ) ;
        if( GetNextEvent( everyEvent, &ev ) ) {
            switch( ev.what ) {
            case mouseDown:
                DoMouseDown( &ev ) ;
                break ;
            case mouseUp:
                break ;
            case keyDown:
                break ;
            case keyUp:
                break ;
            case activateEvt:
                DoActivate( &ev ) ;
                break ;
            case updateEvt:
                DoUpdate( &ev ) ;
                break ;
            }
        }else{
            if( ( automatic_calculation || do_calc_now ) && calc_data 
) {
                DoCalc( calc_hdl ) ;
                do_calc_now = FALSE ;
                calc_data = FALSE ;
            }
        }
    }
    return ;
}
Listing:  Parser.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include <Strings.h>
#include <Math.h>
#include <Ctype.h>
#include <Stdio.h>

#include “MacCalc.h”
#include “CalcData.h”
#include “Parser.h”

unsigned char *curr_pos = NULL ;
int parse_err = 0 ;
Str255 buffer ;

/* Simple algabraic expression parser */

double ParseFormula( formula, error )
unsigned char *formula ;
int *error ;
{
    register double value ;

    /* convert into c string in buffer */
    BlockMove( &formula[2], buffer, formula[0]-1 ) ;
    buffer[formula[0]-1] = 0 ;  /* 0 terminate buffer */
    
    curr_pos = buffer ;
    parse_err = 0 ;
    
    v( = ParseExpression( ) ;
    
    *error = parse_err ;        /* Set error flag */
    
    return ( value ) ;
}
double ParseExpression( )
{
    register double val ;
    
    val = ParseFactor( ) ;
    
    switch( *curr_pos ) {
    case ‘+’:
        curr_pos++ ;
        val += ParseExpression( ) ;
        break ;
    case ‘-’:
        curr_pos++ ;
        val -= ParseExpression( ) ;
        break ;
    case ‘*’:
        curr_pos++ ;
        val *= ParseExpression( ) ;
        break ;
    case ‘/’:
        curr_pos++ ;
        val /= ParseExpression( ) ;
        break ;
    }
    return val ;
}
double ParseFactor( )
{
    register double val = 0 ;
    register double val2 ;
    register int has_sign = FALSE ;
    
    if( *curr_pos == ‘-’ ) {
        has_sign = TRUE ;
        curr_pos++ ;
    }
    
    if( *curr_pos != ‘(‘ ) {
        /* determine whether this is an address or not */
        if( IsDigit( *curr_pos ) || *curr_pos == ‘.’ ) {
            val = ParseValue( ) ;
        }else{
            if( IsFunction( ) ) {
                val = CallFunction( ) ;
            }else{
                val = ParseAddress( ) ;
            }
        }

        switch( *curr_pos ) {
        case ‘^’:
            curr_pos++ ;
            val2 = ParseFactor( ) ;
            val = pow( val, val2 ) ;
            break ;
        case ‘*’:
            curr_pos++ ;
            val2 = ParseFactor( ) ;
            val *= val2 ;
            break ;
        case ‘/’:
            curr_pos++ ;
            val2 = ParseFactor( ) ;
            val /= val2 ;
            break ;
        }
    }else{
        curr_pos++ ;
        val = ParseExpression( ) ;
        if( *curr_pos == ‘)’ ) {
            curr_pos++ ;
        }else{
            parse_err = MISMATCHED_PARENTHESIS ;
        }
    }
    
    return ( has_sign ? -( val ):val ) ;
}
double ParseValue( )
{
    register double val = 0 ;
    
    if( IsDigit( *curr_pos ) || ( *curr_pos == ‘.’ ) ) {
        val = atof( ) ;
    }else{
        parse_err = INVALID_NUMBER ;
    }
    return val ;
}
double ParseAddress( )
{
    register int row ;
    register int column ;
    register double val = 0 ;
    
    column = GetColumn( ) ;
    row = GetRow( ) ;
    
    if( ( row > MAX_ROWS ) || ( column > MAX_COLUMNS ) ) {
        parse_err = ADDRESS_TOO_LARGE ;
    }else{
        val = curr_sheet_ptr->sheet_data[row-1][column-1].value ;
    }
    return val ;
}
int GetRow( )
{
    register int row ;
    
    if( IsDigit( *curr_pos ) ) {
        row = *curr_pos - ‘0’ ;
    }else{
        parse_err = INVALID_ADDRESS ;
    }
    curr_pos++ ;
    
    return row ;
}
int GetColumn( )
{
    register int column ;
    
    if( IsAlpha( *curr_pos ) ) {
        if( *curr_pos >= ‘a’ ) {
            column = ( *curr_pos - ‘a’ ) + 1 ;
        }else{
            column = ( *curr_pos - ‘A’ ) + 1 ;
        }
    }else{
        parse_err = INVALID_ADDRESS ;
    }
    curr_pos++ ;
    return column ;
}
int IsFunction( )
{
    register unsigned char *p ;
    
    p = curr_pos ;
    while( IsAlpha( *p ) || IsDigit( *p ) ) {
        p++ ;
    }
    return ( *p == ‘(‘ ) ? TRUE:FALSE ;
}
double CallFunction( )
{
    unsigned char fun_name[32] ;
    register unsigned char *p ;
    register int fun_number ;
    register double value ;
    register ARG_PTR args ;
    
    p = fun_name ;
    while( IsAlpha( *curr_pos ) || IsDigit( *curr_pos ) ) {
        *p = toupper( *curr_pos ) ;
        p++; curr_pos++;
    }
    *p = ‘\0’ ;
    curr_pos++ ;
    args = BuildArg( ) ;
    if( ( fun_number = Lookup( fun_name ) ) > -1 ) {
        value = (*fun_table[fun_number].fun_ptr)( args ) ;
    }else{
        parse_err = INVALID_FUNCTION ;
    }
    DestroyArgs( args ) ;
    return value ;
}
int Lookup( fun_name )
unsigned char *fun_name ;
{
    register int i = 0 ;
    
    while( fun_table[i].fun_name[0] != 0 ) {
        if( !strcmp( fun_name, fun_table[i].fun_name ) ) {
            return i ;
        }
        i++ ;
    }
    return -1 ;
}
ARG_PTR BuildArg( )
{
    int error ;
    ARG_PTR first_arg_ptr = NULL, last_arg_ptr = NULL, next_arg_ptr = 
NULL ;
    
    /* This needs to be changed so that recursive functions calls can 
be made */
    while( *curr_pos != ‘)’ ) {
        next_arg_ptr = GetArg( ) ;
        next_arg_ptr->value = ParseExpression( ) ;
        next_arg_ptr->type = VALUE_ARG ;
        if( *curr_pos == ‘,’ ) {
            curr_pos++ ;
        }
        if( last_arg_ptr != NULL ) {
            last_arg_ptr->next_arg = next_arg_ptr ;
        }
        if( first_arg_ptr == NULL ) {
            first_arg_ptr = next_arg_ptr ;
        }
        last_arg_ptr = next_arg_ptr ;
    }
    next_arg_ptr->next_arg = NULL ;
    
    /* Now pass the last parenthesis by */
    if( *curr_pos == ‘)’ ) {
        curr_pos++ ;
        return first_arg_ptr ;
    }else{
        parse_err = MISMATCHED_PARENTHESIS ;
        return NULL ;
    }
}
double atof( )
{
    register double val = 0.0 ;
    register double val2 = 0.0 ;
    
    if( IsDigit( *curr_pos ) || ( *curr_pos == ‘.’ ) ) {
        while( *curr_pos && IsDigit( *curr_pos ) ) {
            val = ( val * 10 ) + ( *curr_pos - ‘0’ ) ;
            curr_pos++ ;
        }
        if( *curr_pos == ‘.’ ) {
            curr_pos++ ;
        }
        while( *curr_pos && IsDigit( *curr_pos ) ) {
            val2 = ( val2 * 10 ) + ( *curr_pos - ‘0’ ) ;
            curr_pos++ ;
        }
        if( val2 != 0.0 ) {
            while( val2 > 1 ) {
                val2 /= 10 ;
            }
        }
        val += val2 ;
    }else{
        parse_err = INVALID_NUMBER ;
    }
    return val ;

}
void ftoa( val, buffer )
double val ;
unsigned char *buffer ;
{
    long whole ;
    Str255 buff ;
    Str255 tmp ;
    int has_sign ;
    int prec = /*curr_precision*/5 ;

    has_sign = ( val < 0 ) ? TRUE:FALSE ;
    whole = val/1 ;
    NumToString( whole, buffer ) ;
    /* convert into c string in buffer */
    BlockMove( &buffer[1], buff, buffer[0] ) ;
    buff[buffer[0]] = 0 ;  /* 0 terminate buffer */
    val -= whole ;
    if( prec ) {
        do{
            val *= 10.0 ;
        }while( --prec ) ;
        whole = val ;
        NumToString( whole, buffer ) ;
        /* convert into c string in buffer */
        BlockMove( &buffer[1], tmp, buffer[0] ) ;
        tmp[buffer[0]] = 0 ;  /* 0 terminate buffer */
        strcat( buff, “.” ) ;
        strcat( buff, tmp ) ;
    }
    if( has_sign ) {
        tmp[0] = ‘-’ ;
        tmp[1] = ‘\0’ ;
        strcat( tmp, buff ) ;
        strcpy( &buffer[1], tmp ) ;
        buffer[0] = strlen( tmp ) ;
    }else{
        strcpy( &buffer[1], buff ) ;
        buffer[0] = strlen( buff ) ;
    }
    
    return ;
}
double GetFloat( formula, error )
unsigned char *formula ;
int *error ;
{
    register double value ;

    /* convert into c string in buffer */
    BlockMove( &formula[1], buffer, formula[0] ) ;
    buffer[formula[0]] = 0 ;  /* 0 terminate buffer */
    
    curr_pos = buffer ;
    parse_err = 0 ;
    value = atof( ) ;
    *error = parse_err ;        /* Set error flag */
    return ( value ) ;
}
ARG_PTR GetArg( )
{
    register int i ;
    
    for( i=0;i<30;i++){
        if( arg_free_pool[i].in_use == FREE_ARG ) {
            arg_free_pool[i].in_use = IN_USE ;
            return &arg_free_pool[i] ;
        }
    }
    return NULL ;
}
void DestroyArgs( arg_ptr )
ARG_PTR arg_ptr ;
{
    if( arg_ptr != NULL ) {
        PutArg( arg_ptr ) ;
        while( arg_ptr->next_arg != NULL ) {
            arg_ptr = arg_ptr->next_arg ;
            PutArg( arg_ptr ) ;
        }
    }
    return ;
}
void PutArg( arg_ptr )
ARG_PTR arg_ptr ;
{
    arg_ptr->in_use = FREE_ARG ;
    return ;
}
Listing:  SetType.c

#include <WindowMgr.h>
#include <ListMgr.h>
#include <OSUtil.h>
#include <EventMgr.h>

#include “MacCalc.h”
#include “CalcData.h”
#include “Parser.h”

void RemoveLeadingBlanks( unsigned char * ) ;
void PackLine( unsigned char * ) ;

void SetType( cell_ptr, had_data )
CELL_PTR cell_ptr ;
int had_data ;
{
    if( cell_ptr->formula[0] != 0 ) {
        RemoveLeadingBlanks( cell_ptr->formula ) ;
        if( cell_ptr->formula[1] == ‘=’ ) { /* formula */
            cell_ptr->type = FORMULA ;
            PackLine( cell_ptr->formula ) ;
        }else{
            if( IsDigit( cell_ptr->formula[1] ) || 
                ( cell_ptr->formula[1] == ‘.’ ) ) {
                cell_ptr->type = CONSTANT ;
            }else{
                cell_ptr->type = STRING ;
            }
        }
    }else{
        if( had_data ) {
            cell_ptr->type = CLEARED ;
        }else{
            cell_ptr->type = UNDEFINED ;
        }
    }
    return ;
}
void RemoveLeadingBlanks( formula )
unsigned char *formula ;
{
    int length ;
    unsigned char *str ;
    
    length = formula[0] ;
    str = &formula[1] ;
    while( ( *str == ‘ ‘ ) || ( *str == ‘\t’ ) ) {
        str++ ;
        length-- ;
    }
    BlockMove( str, &formula[1], length ) ;
    formula[0] = length ;
    return ;
}
void PackLine( formula )
unsigned char *formula ;
{
    int old_length ;
    int new_length ;
    int i ;
    unsigned char *str ;
    Str255 buffer ;
    int str_flag = FALSE ;
    
    old_length = formula[0] ;
    new_length = 0 ;
    str = buffer ;
    for( i=1 ; i<= old_length ; i++ ) {
        if( ( ( formula[i] != ‘ ‘ ) || str_flag )
            && ( formula[i] != ‘\t’ ) ) {
            *str = formula[i] ;
            if( formula[i] == ‘\”’ ) {
                str_flag = str_flag ? FALSE:TRUE ;
            }
            new_length++ ;
            str++ ;
        }
    }
    BlockMove( buffer, &formula[1], new_length ) ;
    formula[0] = new_length ;
    return ;
}
Listing:  SheetHndlg.c

#include <ListMgr.h>
#include <WindowMgr.h>

#include “MacCalc.h”
#include “SheetHndlg.h”

char column_header[MAX_COLUMNS] ={ ‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’} ;
char row_header[MAX_ROWS] = {‘1’,’2',’3',’4',’5',’6',’7',’8'} ;
                       
void SetupRowandColumnHeader( ListHandle ) ;
void InitData( SHEET_WIN_HDL ) ;

int OpenNewSpreadsheet( title )
char *title ;
{
    WindowPtr new_window_ptr ;
    SHEET_WIN_HDL new_sheet_hdl ;
    Rect rView, dataBounds ;
    Point cSize ;
    int i ;

    /* variable initialization for screen */
    new_window_ptr = GetNewWindow( 128, NULL, (WindowPtr)-1L );
    new_sheet_hdl =(SHEET_WIN_HDL)NewHandle(sizeof(SHEET_WIN));
    
    /* Set the window title */
    SetWTitle( new_window_ptr, title ) ;
    
    SetRect( &dataBounds, 0, 0, MAX_COLUMNS+1, MAX_ROWS+1 ) ;
    SetRect( &rView, new_window_ptr->portRect.left,
                     new_window_ptr->portRect.top,
                     new_window_ptr->portRect.right - 15,
                     new_window_ptr->portRect.bottom - 15 ) ;
                     
    SetPt( &cSize, CELL_WIDTH, CELL_HEIGTH ) ;
    
    (**new_sheet_hdl).sheet_list_hdl = LNew( &rView, &dataBounds, cSize, 
0,new_window_ptr, TRUE, TRUE, TRUE, TRUE);
                                             
    SetWRefCon( new_window_ptr, (long)new_sheet_hdl ) ;
    
    InitData( new_sheet_hdl ) ;
    
    (**new_sheet_hdl).sheet_window_ptr = new_window_ptr ;
    
    (**(**new_sheet_hdl).sheet_list_hdl).lClikLoop = (Ptr)ClikLoop ;

    SetupRowandColumnHeader( (**new_sheet_hdl).sheet_list_hdl);
    
    ShowWindow( new_window_ptr ) ;
    
    return noErr ;
}
void SetupRowandColumnHeader( list_hdl )
ListHandle list_hdl ;
{
    Cell curr_cell ;
    int i ;
    
    i = 0 ;
    
    for( i = 1 ; i <= MAX_ROWS ; i++ ) {
    
        SetPt( &curr_cell, i, 0 ) ;
        LSetCell( &column_header[i-1], 1, curr_cell, list_hdl);
        SetPt( &curr_cell, 0, i ) ;
        LSetCell( &row_header[i-1],1, curr_cell, list_hdl ) ;
    }
    return ;
}
void InitData( sheet_record_hdl )
SHEET_WIN_HDL sheet_record_hdl ;
{
    int i,j ;
    for( i=0; i<MAX_ROWS;i++){
        for( j=0; j<MAX_COLUMNS;j++ ) {
            (**sheet_record_hdl).sheet_data[i][j].type = 0 ;
            (**sheet_record_hdl).sheet_data[i][j].value = 0L ;
            (**sheet_record_hdl).sheet_data[i][j].formula[0] = 0 ;
        }
    }
    return ;
}
Listing:  Resources.r

*
* MacTutorCalc.R

MacTutorCalc.rsrc
????CALx

Type CALx = STR 
 ,0
Spreadsheet Demo \0D© by Bryan Waters for MacTutor

* Multifinder Menu for Quit Cmd
Type mstr = STR 
 ,100
File

* Multifinder Quit name
Type mstr = STR 
 ,101
Quit

Type SIZE = GNRL
 ,-1
.H
0800    ;; $0800 = bits 11 set
.L
80000 ;; ( recomended)
.L
40000 ;; ( minimum)
.I

Type vers = GNRL
 , 1
.H
01 ;; byte vers # in BCD
10 ;; byte vers part 2 & 3
50 ;; byte release stage $50=release
00 ;; byte stage of non-release
00 00 ;; integer country 0=US
.P
1.1 (US)
.P
SpreadSheet Demo, © by Bryan Waters for MacTutor 1989

Type vers = GNRL
 , 2
.H
05 ;; byte vers # in BCD
30 ;; byte vers part 2 & 3
50 ;; byte release stage $50=release
00 ;; byte stage of non-release
00 00 ;; integer country 0=US
.P
V5.3
.P
MacTutor Volume 5 Number 3

* ------------ menus ------------

Type MENU
  ,1 (0)
 \14

Type MENU
  ,256 (0)
 File
Quit

Type MENU
  ,257 (0)
 Edit
Undo
(-
Cut
Copy
Paste
Clear

Type WIND
  ,128 (0)
MacCalc
43 20 202 419 
Invisible GoAway
0 
0 

Type DLOG
  ,128 (32)
New Dialog
208 70 330 424 
Visible NoGoAway
1 
0 
12258

Type DITL
  ,12258 (0)
4

Button 
96 184 116 244 
Enter

Button 
96 264 116 324 
Cancel

staticText Disabled
8 8 24 88 
Enter data:

editText 
8 96 80 328 


Type DITL
  ,200 (0)
3

Button 
56 160 76 220 
OK

IconItem Disabled
8 16 40 48 
128

staticText Disabled
24 56 40 224 
Mismatched Parenthesis.

Type DITL
  ,201 (0)
3

Button 
56 160 76 220 
OK

IconItem Disabled
8 16 40 48 
128

staticText Disabled
24 56 40 224 
Invalid Number.

Type DITL
  ,202 (0)
3

Button 
56 160 76 220 
OK

IconItem Disabled
8 16 40 48 
128

staticText Disabled
24 56 40 224 
Invalid address.

Type DITL
  ,204 (0)
3

Button 
56 160 76 220 
OK

IconItem Disabled
8 16 40 48 
128

staticText Disabled
24 56 40 224 
Invalid function.

Type DITL
  ,203 (0)
3

Button 
56 160 76 220 
OK

IconItem Disabled
8 16 40 48 
128

staticText Disabled
24 56 40 224 
Address too large.

Type ALRT
  ,200 (32)
118 94 214 338 
200
4444 

Type ALRT
  ,201 (32)
118 94 214 338 
201
4444 

Type ALRT
  ,202 (32)
118 94 214 338 
202
4444 

Type ALRT
  ,204 (32)
118 94 214 338 
204
4444 

Type ALRT
  ,203 (32)
118 94 214 338 
203
4444 

Type ICON = GNRL
  ,128 (32)
.H
0001 8000 0003 C000 0003 C000 0006 6000 
0006 6000 000C 3000 000C 3000 0018 1800 
0019 9800 0033 CC00 0033 CC00 0063 C600 
0063 C600 00C3 C300 00C3 C300 0183 C180 
0183 C180 0303 C0C0 0303 C0C0 0603 C060 
0601 8060 0C01 8030 0C00 0030 1800 0018 
1801 8018 3003 C00C 3003 C00C 6001 8006 
6000 0006 C000 0003 FFFF FFFF 7FFF FFFE 
 
AAPL
$119.00
Apple Inc.
+1.40
MSFT
$47.75
Microsoft Corpora
+0.28
GOOG
$540.37
Google Inc.
-0.71

MacTech Search:
Community Search:

Software Updates via MacUpdate

HoudahSpot 3.9.6 - Advanced file search...
HoudahSpot is a powerful file search tool built upon MacOS X Spotlight. Spotlight unleashed Create detailed queries to locate the exact file you need Narrow down searches. Zero in on files Save... Read more
RapidWeaver 6.0.3 - Create template-base...
RapidWeaver is a next-generation Web design application to help you easily create professional-looking Web sites in minutes. No knowledge of complex code is required, RapidWeaver will take care of... Read more
iPhoto Library Manager 4.1.10 - Manage m...
iPhoto Library Manager lets you organize your photos into multiple iPhoto libraries. Separate your high school and college photos from your latest summer vacation pictures. Or keep some photo... Read more
iExplorer 3.5.1.9 - View and transfer al...
iExplorer is an iPhone browser for Mac lets you view the files on your iOS device. By using a drag and drop interface, you can quickly copy files and folders between your Mac and your iPhone or... Read more
MacUpdate Desktop 6.0.3 - Discover and i...
MacUpdate Desktop 6 brings seamless 1-click installs and version updates to your Mac. With a free MacUpdate account and MacUpdate Desktop 6, Mac users can now install almost any Mac app on macupdate.... Read more
SteerMouse 4.2.2 - Powerful third-party...
SteerMouse is an advanced driver for USB and Bluetooth mice. It also supports Apple Mighty Mouse very well. SteerMouse can assign various functions to buttons that Apple's software does not allow,... Read more
iMazing 1.1 - Complete iOS device manage...
iMazing (was DiskAid) is the ultimate iOS device manager with capabilities far beyond what iTunes offers. With iMazing and your iOS device (iPhone, iPad, or iPod), you can: Copy music to and from... Read more
PopChar X 7.0 - Floating window shows av...
PopChar X helps you get the most out of your font collection. With its crystal-clear interface, PopChar X provides a frustration-free way to access any font's special characters. Expanded... Read more
OneNote 15.4 - Free digital notebook fro...
OneNote is your very own digital notebook. With OneNote, you can capture that flash of genius, that moment of inspiration, or that list of errands that's too important to forget. Whether you're at... Read more
Carbon Copy Cloner 4.0.3 - Easy-to-use b...
Carbon Copy Cloner backups are better than ordinary backups. Suppose the unthinkable happens while you're under deadline to finish a project: your Mac is unresponsive and all you hear is an ominous,... Read more

Latest Forum Discussions

See All

Raby (Games)
Raby 1.0.3 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0.3 (iTunes) Description: ***WARNING - Raby runs on: iPhone 5, iPhone 5C, iPhone 5S, iPhone 6, iPhone 6 Plus, iPad Mini Retina, iPad Mini 3, iPad 4, iPad Air,... | Read more »
Oddworld: Stranger's Wrath (Games)
Oddworld: Stranger's Wrath 1.0 Device: iOS Universal Category: Games Price: $5.99, Version: 1.0 (iTunes) Description: ** PLEASE NOTE: Oddworld Stranger's Wrath requires at least an iPhone 4S, iPad 2, iPad Mini or iPod Touch 5th gen... | Read more »
Bounce On Back (Games)
Bounce On Back 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: | Read more »
Make Way for Fat Chicken, from the Maker...
Make Way for Fat Chicken, from the Makers of Scrap Squad Posted by Jessica Fisher on November 26th, 2014 [ permalink ] Relevant Games has announced they will be releasing their reverse tower defense game, | Read more »
Tripnary Review
Tripnary Review By Jennifer Allen on November 26th, 2014 Our Rating: :: TRAVEL BUCKET LISTiPhone App - Designed for the iPhone, compatible with the iPad Want to create a travel bucket list? Tripnary is a fun way to do exactly that... | Read more »
Ossian Studios’ RPG, The Shadow Sun, is...
Ossian Studios’ RPG, The Shadow Sun, is Now Available for $4.99 Posted by Jessica Fisher on November 26th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Mmmm, Tasty – Having the Angry Birds for...
The very first Angry Birds debuted on iOS back in 2009. When you sit back and tally up the number of Angry Birds games out there and the impact they’ve had on pop culture as a whole, you just need to ask yourself: “How would the birds taste... | Read more »
Rescue Quest Review
Rescue Quest Review By Jennifer Allen on November 26th, 2014 Our Rating: :: PATH BASED MATCH-3Universal App - Designed for iPhone and iPad Guide a wizard to safety by matching gems. Rescue Quest might not be an entirely original... | Read more »
You Can Play the Final Chapter of Lone W...
You Can Play the Final Chapter of Lone Wolf: Dawn Over V’taag Right Now Posted by Jessica Fisher on November 26th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Swords of Anima (Games)
Swords of Anima 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: A new tactical turn-based RPG experience. Command the Savior Rex Squad in an epic journey of courage and deception. Can you... | Read more »

Price Scanner via MacPrices.net

2014 1.4GHz Mac mini on sale for $449, save $...
 B&H Photo has the new 1.4GHz Mac mini on sale for $449.99 including free shipping plus NY tax only. Their price is $50 off MSRP, and it’s the lowest price available for this new model. Adorama... Read more
Early Black Friday pricing on 27-inch 5K iMac...
 B&H Photo continues to offer Black Friday sale prices on the 27″ 3.5GHz 5K iMac, in stock today and on sale for $2299 including free shipping plus NY sales tax only. Their price is $200 off MSRP... Read more
Early Black Friday sale prices on iPad Air 2,...
 MacMall is discounting iPad Air 2s by up to $75 off MSRP as part of their Black Friday sale. Shipping is free: - 16GB iPad Air WiFi: $459 $40 off - 64GB iPad Air WiFi: $559 $40 off - 128GB iPad Air... Read more
Early Black Friday MacBook Air sale prices, $...
 MacMall has posted early Black Friday MacBook Air sale prices. Save $101 on all models for a limited time: - 11″ 1.4GHz/128GB MacBook Air: $798 - 11″ 1.4GHz/256GB MacBook Air: $998 - 13″ 1.4GHz/... Read more
Why iPhone 6 Tablet/Laptop Cannibalization Is...
247wallst.com blogger Douglas A. McIntyre noted last week that according to research posted on the Applovin blog site the iPhone 6 is outselling the iPhone 6 Plus by a wide margin . Hardly a surprise... Read more
Worldwide Tablet Growth Expected to Slow to 7...
The global tablet market is expected to record massive deceleration in 2014 with year-over-year growth slowing to 7.2%, down from 52.5% in 2013, according to a new forecast from International Data... Read more
Touchscreen Glove Company Announces New Produ...
Surrey, United Kingdom based TouchAbility specializes in design and manufacture of a wide variety of products compatible with touchscreen devices including smartphones, tablets and computers. Their... Read more
OtterBox Alpha Glass Screen Protectors for iP...
To complement the bigger, sharper displays on the latest Apple devices, OtterBox has introduced Alpha Glass screen protectors to the iPhone 6 and iPhone 6 Plus. The fortified glass screen protectors... Read more
Early Black Friday Mac Pro sale, 6-Core 3.5GH...
 B&H Photo has the 6-Core 3.5GHz Mac Pro on sale today for $3499 including free shipping plus NY sales tax. Their price is $500 off MSRP, and it’s the lowest price available for this model from... Read more
Early Black Friday sale price: 15-inch 2.2GHz...
 B&H Photo has the 2014 15″ 2.2GHz Retina MacBook Pro on sale today for $1699.99. Shipping is free, and B&H charges NY sales tax only. Their price is $300 off MSRP, equalling Best Buy’s price... Read more

Jobs Board

*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.