From eff7a1f733ab2e02c0faedea35d574cac0a6e42d Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Sun, 14 Jun 2015 15:06:46 +0000 Subject: [PATCH] unpk.c moved to unpk.c.obsolete. This function lives in wsprd_utils.c git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5607 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/wsprd/unpk.c | 122 ----------------------------------------------- 1 file changed, 122 deletions(-) delete mode 100644 lib/wsprd/unpk.c diff --git a/lib/wsprd/unpk.c b/lib/wsprd/unpk.c deleted file mode 100644 index dcae675e1..000000000 --- a/lib/wsprd/unpk.c +++ /dev/null @@ -1,122 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "nhash.h" -#include "wsprd_utils.h" - -void unpk_(signed char message[], int *nhashtab, char call_loc_pow[]) -{ - int i,n1,n2,n3,ndbm,ihash,nadd,noprint,nh; - char callsign[13],grid[5],grid6[7],cdbm[3]; - static char hashtab[32768][13]; - FILE *fhash; - - if(*nhashtab==1) { - char line[80], hcall[12]; - if( (fhash=fopen("hashtable.txt","r+")) ) { - while (fgets(line, sizeof(line), fhash) != NULL) { - sscanf(line,"%d %s",&nh,hcall); - strcpy(*hashtab+nh*13,hcall); - } - } else { - fhash=fopen("hashtable.txt","w+"); - } - fclose(fhash); - return; - } - - if(*nhashtab==2) { - fhash=fopen("hashtable.txt","w"); - for (i=0; i<32768; i++) { - if( strncmp(hashtab[i],"\0",1) != 0 ) { - fprintf(fhash,"%5d %s\n",i,*hashtab+i*13); - } - } - fclose(fhash); - return; - } - - unpack50(message,&n1,&n2); - unpackcall(n1,callsign); - unpackgrid(n2, grid); - int ntype = (n2&127) - 64; - callsign[12]=0; - grid[4]=0; - -/* - Based on the value of ntype, decide whether this is a Type 1, 2, or - 3 message. - - * Type 1: 6 digit call, grid, power - ntype is positive and is a member - of the set {0,3,7,10,13,17,20...60} - - * Type 2: extended callsign, power - ntype is positive but not - a member of the set of allowed powers - - * Type 3: hash, 6 digit grid, power - ntype is negative. -*/ - - if( (ntype >= 0) && (ntype <= 62) ) { - int nu=ntype%10; - if( nu == 0 || nu == 3 || nu == 7 ) { - ndbm=ntype; - memset(call_loc_pow,0,sizeof(char)*23); - sprintf(cdbm,"%2d",ndbm); - strncat(call_loc_pow,callsign,strlen(callsign)); - strncat(call_loc_pow," ",1); - strncat(call_loc_pow,grid,4); - strncat(call_loc_pow," ",1); - strncat(call_loc_pow,cdbm,2); - strncat(call_loc_pow,"\0",1); - ihash=nhash(callsign,strlen(callsign),(uint32_t)146); - strcpy(*hashtab+ihash*13,callsign); - } else { - nadd=nu; - if( nu > 3 ) nadd=nu-3; - if( nu > 7 ) nadd=nu-7; - n3=n2/128+32768*(nadd-1); - unpackpfx(n3,callsign); - ndbm=ntype-nadd; - memset(call_loc_pow,0,sizeof(char)*23); - sprintf(cdbm,"%2d",ndbm); - strncat(call_loc_pow,callsign,strlen(callsign)); - strncat(call_loc_pow," ",1); - strncat(call_loc_pow,cdbm,2); - strncat(call_loc_pow,"\0",1); - ihash=nhash(callsign,strlen(callsign),(uint32_t)146); - strcpy(*hashtab+ihash*13,callsign); - noprint=0; - } - } else if ( ntype < 0 ) { - ndbm=-(ntype+1); - memset(grid6,0,sizeof(char)*7); - strncat(grid6,callsign+5,1); - strncat(grid6,callsign,5); - ihash=(n2-ntype-64)/128; - if( strncmp(hashtab[ihash],"\0",1) != 0 ) { - sprintf(callsign,"<%s>",hashtab[ihash]); - } else { - sprintf(callsign,"%5s","<...>"); - } - - memset(call_loc_pow,0,sizeof(char)*23); - sprintf(cdbm,"%2d",ndbm); - strncat(call_loc_pow,callsign,strlen(callsign)); - strncat(call_loc_pow," ",1); - strncat(call_loc_pow,grid6,strlen(grid6)); - strncat(call_loc_pow," ",1); - strncat(call_loc_pow,cdbm,2); - strncat(call_loc_pow,"\0",1); - - noprint=0; - -// I don't know what to do with these... They show up as "A000AA" grids. - if( ntype == -64 ) noprint=1; - } - // printf("\nUnpacked in C: %s\n",call_loc_pow); -}